Click here to Skip to main content
15,887,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi!
i want the user to redirect to the same page where he entered login info.
or e.g
i have login control on the master page and now for e.g user is navigating some page and for e.g commnent.aspx for some task he need to login .if the user presses login he is redirected to the login page..now after the login i want to automatically redirect to the same page where he was previously like comment.aspx...i want this for every page ..how i could acheive this
Posted

One of various ways:
1. When from comment.aspx, user presses login, save the current URL in a session (call it browsedURLSession) and then redirect to login page.
2. Once the user logs in, save the usser profile in session or maintain the logged in session such that you can identify that user is logged in.
3. Check for browsed URL session value (browsedURLSession), if it's null show the home page. If it holds some url, redirect to that one.

Try!
 
Share this answer
 
Comments
Ed Nutting 7-May-11 17:00pm    
That's the way I always do it, works well, don't really see how else you'd want to do it :) My 5 :)
Please see this code project Q/A. Url rewriting in C#.net[^]
 
Share this answer
 
Comments
Ed Nutting 7-May-11 17:02pm    
Useful for redirecting, but it seems like he's got that bit, so not so useful in helping him with keeping track of the previous page viewed. My 4.

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