Click here to Skip to main content
15,891,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my project a user can comments post articles and I am done with that, but I am stuck at a crucial point.
I would like that a user must be logged in website before he is allowed to post anything. If he wants to post anything he must be logged in.
How to check it whether user is logged in or not?
If he is not logged in then he is directed to login page and if he is already logged in then he is directed to page that he was using. How can this process be carried out?

Please guide.

If possible please provide a small example.
Posted
Updated 5-Nov-11 23:39pm
v2
Comments
R. Giskard Reventlov 6-Nov-11 1:30am    
What have you already tried for yourself?

By maintaining Users login details into "Session".

Have a look at below links for more information on "ASP.NET Session State Overview".
http://msdn.microsoft.com/en-us/library/ms178581.aspx

http://asp.net-tutorials.com/state/sessions/
 
Share this answer
 
Comments
thatraja 6-Nov-11 7:16am    
5!
RaisKazi 6-Nov-11 7:21am    
Thank you Raja. :)
For securely login you can use this

ASP.NET Security[^]

-Thanks.
 
Share this answer
 
Comments
thatraja 6-Nov-11 7:16am    
5!
RaisKazi 6-Nov-11 7:22am    
This is one more aspect of OP's requirement. 5ed.
Tarun Mangukiya 7-Nov-11 6:21am    
Thanks
 
Share this answer
 
Comments
RaisKazi 6-Nov-11 7:23am    
Covers both "User Management" and "Session Management" in one Answer. 5ed.
thatraja 6-Nov-11 7:34am    
Did you forget to vote?

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

  Print Answers RSS


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