Click here to Skip to main content
15,920,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to fetch URL from the address bar.
1. Whenever a user paste a page in Url like
"http://localhost:49800/iUwe/Gallery/Inbox.aspx?Id=1&view=inbox"
2. He should be redired to the login.aspx page because his session Id=null
3. but whenever he login he should be redirected to this page
"http://localhost:49800/iUwe/Gallery/Inbox.aspx?Id=1&view=inbox"
instead of his Home.aspx page.


"How is it possible?"
Posted

You don't have to "fetch the URL". Just see if they're logged in, and if not, redirect them to the login page.
 
Share this answer
 
One of various ways:
1. When your question step 1 happens, in the page load of Inbox.aspx, check for the logged-in session value.
- If it is not null then show the page.
- If it is null then, 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
Monjurul Habib 31-Mar-11 16:06pm    
detail explaination.5+
Step 1: Store the url(http://localhost:49800/iUwe/Gallery/Inbox.aspx?Id=1&view=inbox) in session.

Step2: After successful login retrieve value from session and redirect.
ASP.NET Session State Overview
ASP.NET Session How To
I hope the above information will be helpful. If you have more concerns, please let me know.
 
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