Transfering Pages

B

bshannon

I have an intranet site that uses a login. If a user
clicks a link that requires them to be logged in it will
check.

If a user is not logged in the page takes them to the
login page.

My Problem:
The user will now log in. How can I take the user back
to the page that required the login? I want the user to
go back to the page where they originally clicked the
link that searhed to make sure the user was logged in.

Any help would be appreciated.

Thanks
 
C

Curt_C [MVP]

first, use something like this in your web.config
<authentication mode="Forms">

<forms name=".ASPXCOOKIEDEMO" loginUrl="/tracker/Default.aspx"
protection="All" timeout="20" path="/"></forms>

</authentication>


then in your login page....

if(Request.QueryString["ReturnUrl"] != null)

{

FormsAuthentication.RedirectFromLoginPage(UserID, false);

}

else

{


FormsAuthentication.SetAuthCookie(UserID,false);

Response.Redirect("/home/default.aspx");

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top