After the user entered his valid cridential, and the Identity.IsAuthenticated was true as well as Identiy.Name was not null. But still cannot direct to the protected page. The login page just kept the same.
Here are some code:
Web config:
protection="All"
timeout="60"
name=".OnlineShop"
slidingExpiration="true" requireSSL="false">
Code from login page:
string username = this.txtUserName.Text.Trim();
bool persistent = this.chkPersistent.Checked;
FormsAuthentication.Initialize();
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
username,
DateTime.Now,
DateTime.Now.AddMinutes(30),
persistent,
"User",
FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
// Create the cookie.
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
string returnUrl = Request["ReturnUrl"];
if (string.IsNullOrEmpty(returnUrl))
returnUrl = GetVirtualPath() + "Default.aspx";
// Redirect back to original URL.
Response.Redirect(returnUrl);
Does anyone have some clues about my problem? It made me crazy for days.
Note: It works fine when running locally.
Anh Duc ThaiPosted Jan 14, 2008, 8:30 PM
Niradhip ChakrabortyPosted Jan 14, 2008, 11:05 AM
u please check the connection string,while uploading into server.May be u have some problem in connection string in the time of uploading.
Anh Duc ThaiPosted Jan 14, 2008, 3:16 AM
Can anyone help me?