BestTechie Forums: Asp.net C # Upload And Login And Smtpmail, C#, C# - BestTechie Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Asp.net C # Upload And Login And Smtpmail, C#, C#


#1 User is offline   sahin 

  • Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 20-June 08

Posted 20 June 2008 - 02:51 AM

UPLOAD


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 = "[email protected]";

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 = "[email protected]";

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);

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users