Click here to Skip to main content
15,918,178 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am developing an application using asp.net 4.0 vb and SQL server.
I am using asp.net login controls(Login,LoginView and LoginStatus)

I want to use session for each User.
I want exact lines of code for assign session to user after login
and remove user from session once clicks Logout button.

Can anyone help me.
Thank you,
Posted

Although this doesn't use the login controls, it does give you more flexibility and security.

Role-based Security with Forms Authentication[^]
 
Share this answer
 
Comments
yu2ish 31-Oct-12 13:29pm    
The problem is i have a separate table for admin
therefore no need for the roles :/
Ok with out knowing an awful lot about you system as it currently stands to set the session you can use:

Session("User") = "your value you wish to store"

Then to remove / clear the session when the user clicks logout you can use:

session.clear()

or simply

Session("User") = ""
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900