views:

167

answers:

1

we are running into an issue with our ASP server.

If you try to access a password protected page it does a security check and redirects you if you are not logged in, retaining the URL (ie. Members/MemberLogin.aspx?doc=/PodCast/Default.aspx)

The vb script places the "/PodCast/Default.aspx" in a variable and holds it until the login process is complete.

Once the user types in their username and password it is suppose to do a Response.Redirect(strRedirectURL) and go to the "/PodCast/Default.aspx" but instead it goes to the default.aspx page for logging in successfully.

The kicker is, I know the code is 100% correct becuase it was working on our previous server, but when we pushed all the data onto this server, everything works BUT that piece.

Any suggestions, would be great!

Thanks everyone!

A: 

Do you use custom redirection code? The default querystring parameter ASP.NET uses for redirection after login is ReturnUrl.

You gave the example: Members/MemberLogin.aspx?doc=/PodCast/Default.aspx.

Based on this, I would assume once logged in, the .net framework checks the value of Request.QueryString["ReturnUrl"] and finding it empty, so the site redirects to the base url.

If for some reason you are constructing a non-standard url using doc as your querystring parameter, you could hook into your Login control's OnLogin event, such as:

markup:

<asp:Login id="Login1" runat="server" OnLoggedIn="Login1_LoggedIn" />

code:

protected void Login1_LoggedIn(object sender, EventArgs e)
{
    string url = Request.QueryString["doc"];
    if(!string.IsNullOrEmpty(url))
    {
        Response.Redirect(url);
    }
}
KP
first off, I am not much a .net guy so bare with me if i sound ignorant.The person who wrote all this is no longer here and the code seems to be kind of faulty here and there with uncommon practices.that being said, the login page detects the previous page it places it in a string variable once the page loads. After you enter your username and password it seems to reload and loose the variable information and default to what the else variable declares.Does that make sense? lolThanks for your help!
Brad
This is the if statement i mention aboveIf Len(strRequestedDoc) > 0 Then strRedirectURL = strRequestedDoc Else strRedirectURL = "/Members" End If
Brad
Can you post your code-behind for the login page? It's going to be pretty hard to help without it since you're using custom functionality. Source code is key here I think.
KP