TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Anh Duc Thai
NA
57
25.1k
Login page works fine on localhost but does not on server?
Jan 13 2008 3:56 AM
I made a custom login page for my website. The login feature worked fine when i ran it on localhost. But had problem when it was uploaded to the server.
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:
<sessionState mode="InProc"></sessionState>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" path="/"
defaultUrl="Default.aspx"
protection="All"
timeout="60"
name=".OnlineShop"
slidingExpiration="true" requireSSL="false">
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
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.
Reply
Answers (
3
)
display data vertically in gridview
Migrating Oracle Forms to ASP.NET