Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#

Question posted by: senol (Newbie) on June 23rd, 2008 07:11 AM
UPLOAD


Code: ( text )
  1. bu class
  2. public static void ResimYükle(HtmlInputFile HtmlInput, string id,string Klasor,string KatID)
  3.  
  4. {
  5.  
  6. string path_file;
  7.  
  8. path_file = id;
  9.  
  10. string KlasorAdi;
  11.  
  12. KlasorAdi = Klasor;
  13.  
  14. string Kat_ID;
  15.  
  16. Kat_ID = KatID;
  17.  
  18. if (HtmlInput.PostedFile.FileName.ToString() != "")
  19.  
  20. {
  21.  
  22. Directory.CreateDirectory(HttpContext.Current.Serv   er.MapPath("FirmaSiteleri/" + path_file + "/" + KlasorAdi + "/" + Kat_ID));//KLASÖR OLUŞTUR
  23.  
  24. HtmlInput.PostedFile.SaveAs(HttpContext.Current.Se   rver.MapPath("FirmaSiteleri/" + path_file + "/" + KlasorAdi + "/" + Kat_ID + "/" +
  25.  
  26. Path.GetFileName(HtmlInput.PostedFile.FileName)
  27.  
  28. ));// İLGİLİ KAYDET
  29.  
  30. }
  31.  
  32. }
  33.  
  34. bu dizayn
  35. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BenimSayfamLogo.aspx.cs" Inherits="BenimSayfamLogo" %>
  36.  
  37. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  38.  
  39. <html xmlns="http://www.w3.org/1999/xhtml" >
  40.  
  41. <head runat="server">
  42.  
  43. <title>Logo</title>
  44.  
  45. </head>
  46.  
  47. <body>
  48.  
  49. <form~/BenimSayfam.aspx">Önceki Sayfaya Geç</asp:HyperLink>
  50.  
  51. &nbsp; &nbsp;
  52.  
  53. <asp:HyperLink~/BenimsayfamKategoriHakkimizda.aspx"
  54.  
  55. Width="191px">Hakkımızda Sayfasına Dön</asp:HyperLink><br />
  56.  
  57. <br />
  58.  
  59. &nbsp;&nbsp; Firma Logonuz
  60.  
  61. <input /><br />
  62.  
  63. <br />
  64.  
  65. </div>
  66.  
  67. </form>
  68.  
  69. </body>
  70.  
  71. </html>
  72.  
  73. cs codu
  74. using System;
  75.  
  76. using System.Data;
  77.  
  78. using System.Configuration;
  79.  
  80. using System.Collections;
  81.  
  82. using System.Web;
  83.  
  84. using System.Web.Security;
  85.  
  86. using System.Web.UI;
  87.  
  88. using System.Web.UI.WebControls;
  89.  
  90. using System.Web.UI.WebControls.WebParts;
  91.  
  92. using System.Web.UI.HtmlControls;
  93.  
  94. using System.IO;
  95.  
  96. using System.Text;
  97.  
  98. public partial class BenimSayfamLogo : System.Web.UI.Page
  99.  
  100. {
  101.  
  102. protected void Page_Load(object sender, EventArgs e)
  103.  
  104. {
  105.  
  106. if (Session["ID"] != null)
  107.  
  108. {
  109.  
  110. }
  111.  
  112. else
  113.  
  114. {
  115.  
  116. Response.Redirect("Default.aspx");
  117.  
  118. }
  119.  
  120. }
  121.  
  122. protected void Button1_Click(object sender, EventArgs e)
  123.  
  124. {
  125.  
  126. if (Path.GetExtension(File1.PostedFile.FileName) == ".gif" || Path.GetExtension(File1.PostedFile.FileName) == ".jpg")
  127.  
  128. {
  129.  
  130. baglantitable.Sorgu_Calistir("Update tbl_firma set firmalogo=’" + Path.GetFileName(File1.PostedFile.FileName) + "’ where["ID"]);
  131.  
  132. baglantitable.ResimYükle(File1, Session["ID"].ToString(), "Logo", Session["ID"].ToString());
  133.  
  134. }
  135.  
  136. else
  137.  
  138. {
  139.  
  140. string hataAc;
  141.  
  142. hataAc = "<script>" + "alert(’Logo Resmi Jpg veya Gif Resmi Seçmelisiniz !’)" + "</script>";
  143.  
  144. Page.RegisterStartupScript("JavaScript", hataAc.ToString());
  145.  
  146. }
  147.  
  148. }
  149.  
  150. }
  151.  
  152.  
  153.  
  154.  
  155.  
  156. LOGiN
  157.  
  158. al kadeşim
  159.  
  160. user ve pass sorguladıktan sonra hadi onuda eklim
  161.  
  162. al bu class
  163.  
  164. public static Boolean Oturumu_Ac(string Table_name, string User_Name, string User_pass)
  165.  
  166. {
  167.  
  168. MySqlCommand Oturum_sql = new MySqlCommand("select * from " + Table_name + " where lbl_k=’" + User_Name + "’ and sifre=’" + User_pass + "’ and site=’2′ ", sqlBaglanti);
  169.  
  170. if (Oturum_sql.Connection.State == ConnectionState.Closed)
  171.  
  172. {
  173.  
  174. sqlBaglanti.Open();
  175.  
  176. }
  177.  
  178. MySqlDataReader sql_oku = Oturum_sql.ExecuteReader();
  179.  
  180. if (sql_oku.Read())
  181.  
  182. {
  183.  
  184. HttpContext.Current.Session["ID"] = sql_oku["id"].ToString();
  185.  
  186. sqlBaglanti.Close();
  187.  
  188. return true;
  189.  
  190. }
  191.  
  192. else
  193.  
  194. {
  195.  
  196. sqlBaglanti.Close();
  197.  
  198. return false;
  199.  
  200. }
  201.  
  202. }
  203.  
  204. al bu cs
  205.  
  206. if (baglantitable.Oturumu_Ac("tablo", txtKullanici.Text, txtSifre.Text) == true)
  207.  
  208. {
  209.  
  210. Session["Login"] = "true";
  211.  
  212. Response.Redirect("musteri.aspx");
  213.  
  214. }
  215.  
  216. else
  217.  
  218. {
  219.  
  220. Session["Login"] = "false";
  221.  
  222. lblHata.Visible = true;
  223.  
  224. lblHata.Text = "LÜTFEN KULLANICI ADI VE ŞİFRENİZİ DOĞRU GİRİNİZ !";
  225.  
  226. }
  227.  
  228. buda diyer sayfalara geçinde Session kontrolu,,
  229. protected void Page_Load(object sender, EventArgs e)
  230. {
  231.  
  232. if (Session["ID"] != null)
  233.  
  234. {
  235.  
  236. }
  237.  
  238. else
  239.  
  240. {
  241.  
  242. Response.Redirect("Default.aspx");
  243.  
  244. }
  245.  
  246. }
  247.  
  248. bu kadar bilgi nerde
  249.  
  250. mail
  251.  
  252. using System.Web.Mail;
  253.  
  254. MailMessage mailObj = new MailMessage();
  255.  
  256. MailMessage bize = new MailMessage();
  257.  
  258. mailObj.From = "bravilor@bravilorturkiye.com";
  259.  
  260. mailObj.To = TextBox2.Text;
  261.  
  262. mailObj.Subject = "Bravilor Türkiye Fiyat Listesi ";
  263.  
  264. mailObj.Body = "<strong>Bizi Tercih Ettiğiniz İçin Teşşekür Ederiz En Yakın Zamanda Size Geri Döneceğiz !</strong>";
  265.  
  266. mailObj.BodyFormat = MailFormat.Html;
  267.  
  268. SmtpMail.SmtpServer = "localhost";
  269.  
  270. SmtpMail.Send(mailObj);
  271.  
  272. bize.From = TextBox2.Text;
  273.  
  274. bize.To = "bravilor@bravilorturkiye.com";
  275.  
  276. bize.Subject = "Bravilor Türkiye Yeni Fiyat Talebi";
  277.  
  278. bize.Body = "<strong>Fiyat Talep Var </strong>";
  279.  
  280. bize.BodyFormat = MailFormat.Html;
  281.  
  282. SmtpMail.SmtpServer = "localhost";
  283.  
  284. SmtpMail.Send(bize);

MY WEB PAGE
http://www.evdenevenakliyatbul.com/
http://www.paslanmazbul.net
Last edited by DrBunchman : June 23rd, 2008 at 10:18 AM. Reason: Added code tags - note the # button
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
insertAlias's Avatar
insertAlias
Moderator
941 Posts
June 23rd, 2008
01:20 PM
#2

Re: ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#
Is there a question there? Or is this a tutorial? I have no idea.

Reply
senol's Avatar
senol
Newbie
6 Posts
June 24th, 2008
06:35 AM
#3

Re: ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#
yes tutorial .. . . .

Reply
insertAlias's Avatar
insertAlias
Moderator
941 Posts
June 24th, 2008
01:12 PM
#4

Re: ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#
Quote:
Originally Posted by senol
yes tutorial .. . . .


Well, you might want to write up a paragraph or two explaining what you are doing, and you might want to put it in the "Articles" section. It's a little hard to just read large chunks of code with no explanation.

Reply
Frinavale's Avatar
Frinavale
Forum Leader
2,128 Posts
June 24th, 2008
01:28 PM
#5

Re: ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#
Quote:
Originally Posted by senol
yes tutorial .. . . .


Thanks for contributing this to the .NET forum. This would be much more useful as a proper article supported with the code example you have provided.

Please let me know if you are interested in updating this into an article and I will help you edit your original post.

Reply
senol's Avatar
senol
Newbie
6 Posts
July 4th, 2008
06:20 AM
#6

Re: ASP.NET C # UPLOAD and LOGIN and SmtpMail, C#, c#
no sample dowunload
my prodack

Reply
Reply
Not the answer you were looking for? Post your question . . .
180,793 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top .NET Forum Contributors