Link to home
Start Free TrialLog in
Avatar of thebigo
thebigoFlag for United States of America

asked on

Windows authentication works in debug but not in published web site

Hello
I have a web application written in VB (VS 2008) with the code below in global.aspx.
When I run the application in Debug it works perfectly - I go to default.aspx. When I publish the application and run through a normal browser session the User.Identity.Name is blank and User.Identity.IsAuthenticated is False and I go to login.aspx. My PC is a 64bit Vista Ultimate. In IIS7 I have both Anonymous Authentication and Windows Authentication enabled. I have a separate Application Pool for the application and have given NETWORK SERVICE read access to the site.
Can anyone help??
Regards
James
If txtReader.GetElementsByTagName("Security").Item(0).InnerText = "Windows" And User.Identity.IsAuthenticated Then
    authUserName = User.Identity.Name
    x = InStr(authUserName, "\")
    sessionHandler.UserName = Right(authUserName, Len(authUserName) - x)
Else
    Response.Redirect("login.aspx")
end if

Open in new window

Avatar of sunithnair
sunithnair

Try disabling Anonymous Authentication and just keep the Integrated Windows authentication enabled.
Avatar of thebigo

ASKER

If I do that I get a Windows login prompt before any page is displayed.

Regards
James
If you login with your username and password in that prompt are you redirected to the default.aspx page? Have you enabled Windows authentication in Web.Config and are you using a domain acount or local user account?
ASKER CERTIFIED SOLUTION
Avatar of thebigo
thebigo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial