Forms Authentication does not work when using computer name

A

AndrewV

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);


}

}
 

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,780
Messages
2,569,611
Members
45,282
Latest member
RoseannaBa

Latest Threads

Top