Click here to Skip to main content
16,004,164 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
suppose i want to make a website where an user needs to login when he wants to give ratings,write reviews,buy an item....suppose user logs in while giving ratings...but he also needs to log in again when he clicks on buy an item because i have redirected it to the log in page on each of the three options.How to avoid it so that he logs in once and can do all the things?


[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 30-Apr-13 5:38am
v2
Comments
Richard C Bishop 30-Apr-13 11:29am    
Stop redirecting to the login page everytime. Just store the user details in session and check that before you load the next page, if you are not using .Net membership that is.
OriginalGriff 30-Apr-13 11:38am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

1 solution

richcb is correct there should only be one login. If not logged in and the user is navigating to a page that needs to be logged in then redirect them. You use session throughout the pages to check if the user is logged in. Grab the username from the username textbox and add it to the session. If that session is empty when they try to comment, then redirect.

Here's a link on how to add to session that will help you if you don't know how.
 
Share this answer
 
v2

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