MOSSPOINT
asked on
Detecting VB.net login
Hi experts,
I'm writing a .net web application using visual basic and I'm struggling with the membership/login functionality.
I've got the membership database setup and have logged in after a fashon and I'm not sure if i'm doing it correctly.
Basically what I want to do is, after the user has logged in using the standard vb.net login tool and membership table lookup is navigate to a different web page and should the user log out redirect the user to the login page.
Could someone give me a code example on how this is done?
I'm writing a .net web application using visual basic and I'm struggling with the membership/login functionality.
I've got the membership database setup and have logged in after a fashon and I'm not sure if i'm doing it correctly.
Basically what I want to do is, after the user has logged in using the standard vb.net login tool and membership table lookup is navigate to a different web page and should the user log out redirect the user to the login page.
Could someone give me a code example on how this is done?
Basically you would use session variables and master page / Base Page
In you master page Load event you would check for
If Not Session("IsLoggedIn") Is Nothing AndAlso Session("IsLoggedIn") = True Then
'user can proceed , run appropriate code here
Else
response.redirect("login.a spx")
End If
In your login page on the OnloggedIn event of the logn control you would set Session("IsLoggedIn") = true
When the user logs out you would remove the Session.Remove("IsLoggedIn ")
This approach will affect site ide access
In you master page Load event you would check for
If Not Session("IsLoggedIn") Is Nothing AndAlso Session("IsLoggedIn") = True Then
'user can proceed , run appropriate code here
Else
response.redirect("login.a
End If
In your login page on the OnloggedIn event of the logn control you would set Session("IsLoggedIn") = true
When the user logs out you would remove the Session.Remove("IsLoggedIn
This approach will affect site ide access
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works a treat, thanks
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.loggedin.aspx
You will just redirect the user whereever you want after he/she logges-in.