Forms authentication problems

  • Thread starter Thread starter Lloyd Sheen
  • Start date Start date
L

Lloyd Sheen

Way too many times while debugging I click a menu button to go to a page
which needs authentication to happen. The logon form is not shown. I have
closed VS2003, stopped IIS and restarted but to no avail.

Any ideas?

Lloyd Sheen
 
Hi Lloyd,

Check this line in your code:

FormsAuthentication.SetAuthCookie(txtUserName.Text, True)

If the 2nd argument is True like mine is then the cookie is going to persist
across browser sessions. If it is set to False then you should have to log
in every time you close your browser and open it again. Good luck! Ken.

Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
 
I am using the ASPNET.StarterKit as the basis for the site. In the login
page there is no use of FormsAuthentication.SetAuthCookie but uses
FormsAuthentication.RedirectFromLoginPage(customerId ,
RememberLogin.Checked)

I have used the RememberLogin.Checked as checked so imagine that the cookie
still exists. How other than deleting all cookies can I get rid of the
AuthCookie?

Lloyd Sheen
 
Hi Lloyd,

You need to add a logout button to your app. That will clear the cookie
showing that the user is logged in:

Private Sub btnLogout_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnLogout.Click
FormsAuthentication.SignOut()
Response.Redirect("HomePage.aspx")
End Sub

Good luck! Ken.
 
Thanks, that does it.

Lloyd Sheen
Ken Dopierala Jr. said:
Hi Lloyd,

You need to add a logout button to your app. That will clear the cookie
showing that the user is logged in:

Private Sub btnLogout_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnLogout.Click
FormsAuthentication.SignOut()
Response.Redirect("HomePage.aspx")
End Sub

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight

message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top