Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to write a login code for e-commerce and university website in asp.net. Which method of login I should prefer. I want to continue login till user closes the browser. In this case I found difficult to manage with sessions. But I also want security.I think we can implement virtual session using db and cookie. Please suggest what is better option.
Posted
Updated 31-Oct-14 19:23pm
v2

1 solution

Sessions are stored in server memory, and sessions may/maynot use cookies to store something in the browser. Session is basically to identify a user in his security context. The web application uses session to identify whether the user is authenticated.. etc.So use session if you want to store username, login status etc.


Cookies are for client side and be noted that it can be modified by the user. So you should not build an application that uses cookie value for authentication, but at the same time you can use them for themes, user language etc (these are preferencesonly, modifying this will not affect the application secuirty)
 
Share this answer
 
Comments
Member 11058791 3-Nov-14 2:21am    
does it mean session is best way for implementation for authentication?? But session expires and I want user login to last till browser session. In that way can I simulate session using cookies?? Or I should stop thinking about cookies and use session. In many websites I found they use cookies only not session. Please comment on it.

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



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