ReturnURL

T

Tomk

When I logout of my application I redirect to the login page. However the
ReturnURL is placed in the querystring so if the user logs back in it goes
back to the last page where the logout occured. The behavior I'm looking
for is to only use the ReturnURL if the Session timesout.

Logout event found on every page in the application:

Private Sub btnLogout_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogout.Click
UpdateItem()
If (User.Identity.IsAuthenticated) Then
System.Web.Security.FormsAuthentication.SignOut()
End If
Session.Abandon()
Response.Redirect("default.aspx")
End Sub



Login on default.aspx:
....check login credentials, if ok then

FormsAuthentication.SetAuthCookie(txtUserName.Text, False)
If Request.QueryString("ReturnURL") = Nothing Then
Response.Redirect("private/app_start.aspx")
Else
FormsAuthentication.RedirectFromLoginPage("txtUserName.Text", False)
End If
 

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,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top