
Tags:
3d086a1b-50a1-4e6f-8827-eea942b23a65|1|5.0
public static bool DosyaUploadveBoyutlandirma(FileUpload FileUpload1, string yol, string isim,int genislik)
{
try
{
if (FileUpload1.FileName.Length > 0)
{
if (FileUpload1.HasFile)
{
string uzanti = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
if (uzanti == ".jpg" || uzanti == ".gif" || uzanti == ".jpeg" || uzanti == ".png" || uzanti == ".JPG" || uzanti == ".GIF" || uzanti == ".JPEG" || uzanti == ".PNG")
{
Bitmap src = Bitmap.FromStream(FileUpload1.PostedFile.InputStream) as Bitmap;
decimal origWidth = src.Width; // Orjinal Genişlik
decimal origHeight = src.Height; // Orjinal Yükseklik
decimal sngRatio = origWidth / origHeight; // Genişlik ve yükseklik oranı
int newWidth = genislik; // İstenen genişlik
decimal newHeight_temp = newWidth / sngRatio; // Geçici yükseklik (genişlk/oran)
int newHeight = Convert.ToInt16(newHeight_temp); // Yeni genişlik(Geçici yüğksekliğin int hali)
if (src.Width <= genislik)
{
FileUpload1.SaveAs(@yol + "/" + isim + uzanti);
}
else
{
Bitmap result = ResizeBitmap(src, genislik, newHeight);
result.Save(@yol + "/" + isim + uzanti, ImageFormat.Jpeg);
}
return true;
}
}
}
return false; ;
}
catch
{
// // dosya yüklenirken hata olşutu
return false;
}
}
Tags:
7b48d84c-5fef-4092-8c84-c4a56f920a62|1|5.0
public static MailSettingsSectionGroup MailAyar()
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
return(MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
}
Response.Write("host: " + MailAyar().Smtp.Network.Host + "<br />");
Response.Write("port: " + MailAyar().Smtp.Network.Port + "<br />");
Response.Write("Username: " + MailAyar().Smtp.Network.UserName + "<br />");
Response.Write("Password: " + MailAyar().Smtp.Network.Password + "<br />");
Response.Write("from: " + MailAyar().Smtp.From + "<br />");
http://www.dotnetspider.com/forum/179482-how-get-mail-settings-from-web-config-file.aspx
Tags:
a44fac7d-093c-4fc3-b835-cdb3e4fcb203|1|5.0
MsSql de boşluk almak için örnek kullanımı :)
UPDATE Ilceler
SET IlceAdi = LTRIM(RTRIM(IlceAdi))
Tags: mssq, trim
c64e7234-524b-4286-8306-e84e8e3c9c98|1|5.0
bir domain altında başka bir siteyi iframe ile göstermeye çalışırsanız iframe de width="100%" çalışır fakat height="100%" çalışmaz.
varsayılan olarak iframe yüksekliği 250 px görünür.sitenin tamamını gösteremezsiniz.çözüm;
<script type="text/javascript">
function resize_iframe()
{
var height=window.innerWidth;//Firefox
if (document.body.clientHeight)
{
height=document.body.clientHeight;//IE
}
document.getElementById("frame007").style.height = parseInt(height -
document.getElementById("frame007").offsetTop - 8) + "px";
}
window.onresize=resize_iframe;
</script>
KULLANIMI :)
<iframe id="frame007" width="100%" onload="resize_iframe()" src="http://www.siteniz.com/">
</iframe>
Tags: iframe, 100% height, iframe yükseklik
164dc8dd-194f-4880-88a6-33c1024ccc2a|1|5.0
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration; // gerekmeyebilir
yoksa ekliyoruz.
// connectionStrings e erişim
public static string GetConnKey(string key) // varsa değer yoksa null döndürür
{
if (WebConfigurationManager.ConnectionStrings[key] != null)
{
return WebConfigurationManager.ConnectionStrings[key].ConnectionString;
}
else
{
return null;
}
}
// düzenleme
public static bool SetConnValue(string anahtar, string deger) // bağlantı stringini set eder yoksa ekler :).anahtar boş olamaz!!!
{
try
{
Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringsSection connSettingsSection = (ConnectionStringsSection)configuration.GetSection("connectionStrings");
ConnectionStringSettings ss = new ConnectionStringSettings();
ss.ConnectionString = deger;
ss.Name = anahtar;
ss.ProviderName = "System.Data.SqlClient";
if (string.IsNullOrEmpty(GetConnKey(anahtar)))
{
connSettingsSection.ConnectionStrings.Add(ss);
configuration.Save();
}
else
{
connSettingsSection.ConnectionStrings[anahtar].ConnectionString = deger;
configuration.Save();
}
return true;
}
catch
{
return false;
}
}
// kaldırma
public static bool RemoveConnKey(string key) // conn keyi web.config den kaldırır
{
try
{
Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
ConnectionStringsSection connSettingsSection = (ConnectionStringsSection)configuration.GetSection("connectionStrings");
if (GetConnKey(key) != null)
{
connSettingsSection.ConnectionStrings.Remove(key);
configuration.Save();
}
return true;
}
catch
{
return false;
}
}
Tags: connectionStrings
5472129c-54f5-452a-8ce8-66b6016254bd|1|5.0
yazdığım,derlediğim işe yarar statik method,fonksiyonları paylaşıyorum.bir yerden başlamak lazım.
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration; // gerekmeyebilir
yoksa ekliyoruz.
// appSettings e erişim
public static string GetAppKey(string key) // varsa değeri yoksa null döndürür
{
return WebConfigurationManager.AppSettings[key];
}
public static int GetKeyInt(string key) // varsa değeri yoksa 0 döndürür
{
int result;
Int32.TryParse(WebConfigurationManager.AppSettings[key], out result);
return result;
}
public static bool GetKeyBool(string key) // True/False değer kontrolü yapar.
{
bool sonuc;
bool.TryParse(GetAppKey(key),out sonuc);
return sonuc;
}
// düzenleme
public static bool SetAppValue(string anahtar, string deger) // ayar varsa günceller yoksa ekler :=)
{
try
{
Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");
if (GetAppKey(anahtar) == null)
{
appSettingsSection.Settings.Add(anahtar, deger);
configuration.Save();
}
else
{
appSettingsSection.Settings[anahtar].Value = deger;
configuration.Save();
}
return true;
}
catch
{
return false;
}
}
// kaldırma
public static bool RemoveAppKey(string key) // keyi web.config den kaldırır
{
try
{
Configuration configuration = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection appSettingsSection = (AppSettingsSection)configuration.GetSection("appSettings");
if (GetAppKey(key) != null)
{
appSettingsSection.Settings.Remove(key);
configuration.Save();
}
return true;
}
catch
{
return false;
}
}
Tags: appSettings
291429bf-b087-4236-aea0-1dcd9647179b|2|5.0
windows 7 yi w7lxe.exe ile aktif ettikten 3-4 ay sonra son güncellemelerle windows 7 yapı 7600 bu windows kopyası orjinal değil diye bir yazı çıkmaya başlamıştı sağ alt köşede.
aşağıdaki crack yazıyı kaldırdı ve güncelleştirmeler de açık şu an... pek yararlı ilaç :=)
http://rapidshare.com/files/411685663/Sahte_Windows_Sorunu.rar
Tags: windows 7 yapı 7600 bu windows kopyası orjinal değil, crack
53b1942a-17bb-4d6f-aab4-2d4bcd319419|1|5.0
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Id" OnItemDataBound="ListView1_ItemDataBound"
DataSourceID="SqlDataSource1">
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
if (ListView1.EditItem == null) // edit te değiliz
{
ListViewDataItem item = e.Item as ListViewDataItem;
int id = Convert.ToInt32(DataBinder.Eval(item.DataItem, "HaberId"));
string tur = DataBinder.Eval(item.DataItem, "Tur").ToString();
HyperLink HyperLink1 = (HyperLink)e.Item.FindControl("HyperLink1");
switch (tur)
{
case "Haber":
HyperLink1.NavigateUrl = "~/HaberDetay.aspx?HaberId=" + id;
break;
case "Yorum":
HyperLink1.NavigateUrl = "~/YaziDetay.aspx?YaziId=" + id;
break;
default:
break;
}
}
}
}
Tags: onitemdatabound, listview, findcontrol, databinder, eval
121daa97-a00c-486a-8f00-914fb0044c47|5|4.4
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using by_derkan;
public partial class UserControl_Haber1 : System.Web.UI.UserControl
{
private int _HaberId;
public int HaberId
{
get
{
return _HaberId;
}
set
{
_HaberId = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
//HaberId değişkeni değeriyle emrimize amade :=)
// değere bağlı olarak yapılacak işlemler
}
}
<%@ Register src="Haber1.ascx" tagname="Haber1" tagprefix="uc1" %>
<uc1:Haber1 ID="Haber1" HaberId='<%#Eval("Haber1") %>' runat="server" />
c# da herşeyin nesne olduğunu burada anladım.
class ta üye tanımla değer ver ona göre işlem yap :=)
Tags: usercontrol, parametre aktarımı
e6073af0-f1b6-4254-93e6-39cd7afb5613|1|5.0