Forms Authentication does not work when using computer name

Discussion in 'ASP .Net Security' started by AndrewV, Oct 3, 2003.

  1. AndrewV

    AndrewV Guest

    Greetings,

    My asp.net app is using Forms Authentication. Running the project from the
    Visual Studio .NET 2003 has absolutely no problem. I use the sample from
    http://www.eggheadcafe.com/articles/20020906.asp as the forms authentication
    framework. But it doesn't work when the page is accessed directly via an
    independent IE. ie. http://ComputerName/MyApp/default.aspx. After clicking
    the Login button, the authentication code run with no error, but the Login
    page kept getting reloaded and reloaded. I installed the app on a second
    computer to repeat the same test on that computer, and still run into the
    same problem. Testing is done on the same computer as the iis hosting the
    asp.net application, all single machine.

    However, accessing the page with either http://localhost/MyApp/default.aspx
    or http://ip#.xx.xx/MyApp/default.aspx is working fine.

    It's really strange, because it is the same code, on the same computer,
    works from VS.NET IDE, localhost, ip, but not computer name.

    Your input is greatly appreciated.
    Andrew.


    My IIS is version V5.1, OS is WinXPPro, .NET framework is version 1.1.

    1. Excerpt from my config file

    <authentication mode="Forms">
    <forms name="FormsAuthDB.AspxAuth" loginUrl="login.aspx"
    protection="All" timeout ="10" path="/"/>
    </authentication>
    <authorization>
    <deny users="?" />
    <allow users="*"/>
    </authorization>

    2. Code from Application_AuthenticateRequest
    protected void Application_AuthenticateRequest(Object sender, EventArgs e)
    {

    if (HttpContext.Current.User != null)

    {



    FormsIdentity fi = (FormsIdentity)HttpContext.Current.User.Identity;

    FormsAuthenticationTicket fat = fi.Ticket;



    string userData = fat.UserData;

    string[] roles = userData.Split(',');

    // Create a new Generic Principal Instance and assign to Current User

    HttpContext.Current.User = new
    System.Security.Principal.GenericPrincipal(fi, roles);


    }

    }
     
    AndrewV, Oct 3, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page