Response.ReDirect / FormsAuth.ForwardFromLogin not working

From: Matthew Owens via .NET 247 (anonymous_at_dotnet247.com)
Date: 01/23/05

  • Next message: Schipa - Mint Inc.: "Get a blank screen after postback"
    Date: Sun, 23 Jan 2005 09:39:40 -0800
    
    

    Hi,

    I have a login page which does not redirect the user once
    the code has been executed, see below. Whats strange is
    it works perfectly on my localhost when debugging,
    however it fails to redirect when depolyed to a remote
    server. Am I missing any IIS settings or anything? The
    login page just reloads back to itself once the login button has been
    clicked.

    Code for the login button:

    private void _btnLogin_Click(object sender,
    System.Web.UI.ImageClickEventArgs e)
    {
    if (IsValidUser(txtUserName.Text,
    txtPassword.Text)) //interacts with the database. This
    method is fine
            {
                    if(FormsAuthentication.GetRedirectUrl
    (txtUserName.Text,false)=="/appliedbioscience/index.aspx")
                    {
                            FormsAuthentication.SetAuthCookie
    (txtUserName.Text,false);
                            Response.Redirect
    ("http://www.appliedbioscience.co.uk/appliedbioscience/ind
    ex.aspx",false); //fails here
                    }
                    else if
    ((FormsAuthentication.GetRedirectUrl
    (txtUserName.Text,false).ToUpper().IndexOf("ADMIN") != -
    1) && (string)Session["Role"]!="admin")
                            phMsg.Controls.Add(new
    LiteralControl("<font color=red>ERROR: You do not have
    the necessary privellages to administrate this
    site</font>"));
                    else
                    
            FormsAuthentication.RedirectFromLoginPage
    (txtUserName.Text,false); //fails here too
            }
            else
            {
                    phMsg.Controls.Add(new LiteralControl
    ("<font color=red>ERROR: Invalid Username /
    Password</font>"));
            }
    }

    Thanks,
    Matt

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>lNU2IQEA9EeUHBqRN8Z6Mg==</Id>


  • Next message: Schipa - Mint Inc.: "Get a blank screen after postback"