leontry89
سه شنبه 07 آبان 1392, 13:29 عصر
با کد زیر لاگین کاربر در سایت و بررسی می کنم
حالا چطور باید وقتی لاگین کرد به همون صفحه ای که درخواست داده بود بره بره
if (CheckUserNameAndPasswordMach(txtUsername.Text, txtPassword.Text))
{
string role = "user"; //GetMemberRoleByID(txt_uid.Text);
FormsAuthenticationTicket AuthTicket = new FormsAuthenticationTicket(1, txtUsername.Text, DateTime.Now, DateTime.Now.AddHours(1), false, role);
string encryptedTicket = FormsAuthentication.Encrypt(AuthTicket);
HttpCookie AuthCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Add(AuthCookie);
txtPassword.Text = "";
txtUsername.Text = "";
//Response.Redirect("Products.aspx");
}
حالا چطور باید وقتی لاگین کرد به همون صفحه ای که درخواست داده بود بره بره
if (CheckUserNameAndPasswordMach(txtUsername.Text, txtPassword.Text))
{
string role = "user"; //GetMemberRoleByID(txt_uid.Text);
FormsAuthenticationTicket AuthTicket = new FormsAuthenticationTicket(1, txtUsername.Text, DateTime.Now, DateTime.Now.AddHours(1), false, role);
string encryptedTicket = FormsAuthentication.Encrypt(AuthTicket);
HttpCookie AuthCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Add(AuthCookie);
txtPassword.Text = "";
txtUsername.Text = "";
//Response.Redirect("Products.aspx");
}