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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • senol
    Banned
    New Member
    • Jun 2008
    • 6

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

    UPLOAD


    Code:
     bu class 
    public static void ResimYükle(HtmlInputFile HtmlInput, string id,string Klasor,string KatID)
     
    {
     
    string path_file;
     
    path_file = id;
     
    string KlasorAdi;
     
    KlasorAdi = Klasor;
     
    string Kat_ID;
     
    Kat_ID = KatID;
     
    if (HtmlInput.PostedFile.FileName.ToString() != "")
     
    {
     
    Directory.CreateDirectory(HttpContext.Current.Serv er.MapPath("FirmaSiteleri/" + path_file + "/" + KlasorAdi + "/" + Kat_ID));//KLASÖR OLUŞTUR
     
    HtmlInput.PostedFile.SaveAs(HttpContext.Current.Se rver.MapPath("FirmaSiteleri/" + path_file + "/" + KlasorAdi + "/" + Kat_ID + "/" +
     
    Path.GetFileName(HtmlInput.PostedFile.FileName)
     
    ));// İLGİLİ KAYDET
     
    }
     
    }
     
    bu dizayn 
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BenimSayfamLogo.aspx.cs" Inherits="BenimSayfamLogo" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml" >
     
    <head runat="server">
     
    <title>Logo</title>
     
    </head>
     
    <body>
     
    <form~/BenimSayfam.aspx">Önceki Sayfaya Geç</asp:HyperLink>
     
    &nbsp; &nbsp;
     
    <asp:HyperLink~/BenimsayfamKategoriHakkimizda.aspx"
     
    Width="191px">Hakkımızda Sayfasına Dön</asp:HyperLink><br />
     
    <br />
     
    &nbsp;&nbsp; Firma Logonuz
     
    <input /><br />
     
    <br />
     
    </div>
     
    </form>
     
    </body>
     
    </html>
     
    cs codu 
    using System;
     
    using System.Data;
     
    using System.Configuration;
     
    using System.Collections;
     
    using System.Web;
     
    using System.Web.Security;
     
    using System.Web.UI;
     
    using System.Web.UI.WebControls;
     
    using System.Web.UI.WebControls.WebParts;
     
    using System.Web.UI.HtmlControls;
     
    using System.IO;
     
    using System.Text;
     
    public partial class BenimSayfamLogo : System.Web.UI.Page
     
    {
     
    protected void Page_Load(object sender, EventArgs e)
     
    {
     
    if (Session["ID"] != null)
     
    {
     
    }
     
    else
     
    {
     
    Response.Redirect("Default.aspx");
     
    }
     
    }
     
    protected void Button1_Click(object sender, EventArgs e)
     
    {
     
    if (Path.GetExtension(File1.PostedFile.FileName) == ".gif" || Path.GetExtension(File1.PostedFile.FileName) == ".jpg")
     
    {
     
    baglantitable.Sorgu_Calistir("Update tbl_firma set firmalogo=’" + Path.GetFileName(File1.PostedFile.FileName) + "’ where["ID"]);
     
    baglantitable.ResimYükle(File1, Session["ID"].ToString(), "Logo", Session["ID"].ToString());
     
    }
     
    else
     
    {
     
    string hataAc;
     
    hataAc = "<script>" + "alert(’Logo Resmi Jpg veya Gif Resmi Seçmelisiniz !’)" + "</script>";
     
    Page.RegisterStartupScript("JavaScript", hataAc.ToString());
     
    }
     
    }
     
    }
     
     
     
     
     
    LOGiN
     
    al kadeşim 
     
    user ve pass sorguladıktan sonra hadi onuda eklim 
     
    al bu class 
     
    public static Boolean Oturumu_Ac(string Table_name, string User_Name, string User_pass)
     
    {
     
    MySqlCommand Oturum_sql = new MySqlCommand("select * from " + Table_name + " where lbl_k=’" + User_Name + "’ and sifre=’" + User_pass + "’ and site=’2′ ", sqlBaglanti);
     
    if (Oturum_sql.Connection.State == ConnectionState.Closed)
     
    {
     
    sqlBaglanti.Open();
     
    }
     
    MySqlDataReader sql_oku = Oturum_sql.ExecuteReader();
     
    if (sql_oku.Read())
     
    {
     
    HttpContext.Current.Session["ID"] = sql_oku["id"].ToString();
     
    sqlBaglanti.Close();
     
    return true;
     
    }
     
    else
     
    {
     
    sqlBaglanti.Close();
     
    return false;
     
    }
     
    }
     
    al bu cs
     
    if (baglantitable.Oturumu_Ac("tablo", txtKullanici.Text, txtSifre.Text) == true)
     
    {
     
    Session["Login"] = "true";
     
    Response.Redirect("musteri.aspx");
     
    }
     
    else
     
    {
     
    Session["Login"] = "false";
     
    lblHata.Visible = true;
     
    lblHata.Text = "LÜTFEN KULLANICI ADI VE ŞİFRENİZİ DOĞRU GİRİNİZ !";
     
    }
     
    buda diyer sayfalara geçinde Session kontrolu,,
    protected void Page_Load(object sender, EventArgs e)
    {
     
    if (Session["ID"] != null)
     
    {
     
    }
     
    else
     
    {
     
    Response.Redirect("Default.aspx");
     
    }
     
    }
     
    bu kadar bilgi nerde 
     
    mail
     
    using System.Web.Mail;
     
    MailMessage mailObj = new MailMessage();
     
    MailMessage bize = new MailMessage();
     
    mailObj.From = "bravilor@bravilorturkiye.com";
     
    mailObj.To = TextBox2.Text;
     
    mailObj.Subject = "Bravilor Türkiye Fiyat Listesi ";
     
    mailObj.Body = "<strong>Bizi Tercih Ettiğiniz İçin Teşşekür Ederiz En Yakın Zamanda Size Geri Döneceğiz !</strong>";
     
    mailObj.BodyFormat = MailFormat.Html;
     
    SmtpMail.SmtpServer = "localhost";
     
    SmtpMail.Send(mailObj);
     
    bize.From = TextBox2.Text;
     
    bize.To = "bravilor@bravilorturkiye.com";
     
    bize.Subject = "Bravilor Türkiye Yeni Fiyat Talebi";
     
    bize.Body = "<strong>Fiyat Talep Var </strong>";
     
    bize.BodyFormat = MailFormat.Html;
     
    SmtpMail.SmtpServer = "localhost";
     
    SmtpMail.Send(bize);
    MY WEB PAGE

    http://www.paslanmazbu l.net
    Last edited by DrBunchman; Jun 23 '08, 10:18 AM. Reason: Added code tags - note the # button
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Is there a question there? Or is this a tutorial? I have no idea.

    Comment

    • senol
      Banned
      New Member
      • Jun 2008
      • 6

      #3
      yes tutorial .. . . .

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        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.

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          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.

          Comment

          • senol
            Banned
            New Member
            • Jun 2008
            • 6

            #6
            no sample dowunload
            my prodack

            Comment

            Working...