RedirectFromLoginPage

From: Murphy (murphy_at_murphy.com)
Date: 04/12/04


Date: Mon, 12 Apr 2004 09:12:15 +1000

I am trying to code a workaround to avoid being redirected to default.aspx
if the ReturnURL parameter is blank when the RedirectFromLoginPage method is
called.
Depending upon the login status the login button performs either a login or
logout and the appropriate image is displayed, see below:

'*******************************************************
' Displays the applicable image
'*******************************************************
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
 If Request.IsAuthenticated = true Then
    imgSignInOut.ImageUrl="images/signout.gif"
  End If
End Sub

Interestingly before I altered the code and simply used the code below after
the user completed a login everything worked perfectly:
            FormsAuthentication.RedirectFromLoginPage(customerId,
RememberLogin.Checked)

If I check the value of ReturnUrl and do a manual redirect if blank using
the code below Request.IsAuthenticated remains false and as a result the
page load event above always displays the login image...
             If Request.QueryString("ReturnUrl") ="" Then
                Response.Redirect("./")
            Else
                FormsAuthentication.RedirectFromLoginPage(customerId,
RememberLogin.Checked)
            End if

Any ideas ?

Thanks

Murphy