[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

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

0
thebigo
Asked:
thebigo
  • 2
  • 2
1 Solution
 
sunithnairCommented:
Try disabling Anonymous Authentication and just keep the Integrated Windows authentication enabled.
0
 
thebigoAuthor Commented:
If I do that I get a Windows login prompt before any page is displayed.

Regards
James
0
 
sunithnairCommented:
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?
0
 
thebigoAuthor Commented:
No, it keeps asking for a user id and password.
I set the system up on an XP PC running IIS 5.1, with Windows Authentication and using a Hostname - works correctly.
On the Vista PC I removed the Hostname, gave the site a port number and accessed the site via http://servername:801 - then it worked correctly (straight to default.aspx).
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now