Login security in ASP.net

  • Thread starter Steve C. Orr [MVP, MCSD]
  • Start date
M

msnews.microsoft.com

Exactly. You're doing it the old ASP way. Forms Auth is working great for
me.

-Max
 
P

Pravin A. Sable

Hello Everybody,

I have one login page and other pages which will be shown only if user
logs successfully. If someone tries to access page without
identification then she should be directed to login page.

I have following code

after successful login I do...
Session("UserID") = txtUser.Text.Trim()


In every page_load I have code...
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
curUser = CStr(Session("UserID"))
If Len(curUser) = 0 Then
Response.Redirect("./Default.aspx")
End If

End Sub

and in logout button I have...
Private Sub cmdLogout_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdLogout.Click
Session("UserID") = ""
Session("UserName") = ""
curUser = ""
Session.Abandon()
Response.Redirect("./Default.aspx")
End Sub


but it doesn't work. Even after logging out. Other pages can be accessed
straight. I don't know why. Can someone help me? Thanks in advance.

Regards,
Pravin
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top