Windows authentication works in debug but not in published web site

Posted on 2009-04-22
Last Modified: 2012-05-06
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??
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)



end if

Open in new window

Question by:thebigo
    LVL 16

    Expert Comment

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

    Author Comment

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

    LVL 16

    Expert Comment

    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?

    Accepted Solution

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
    Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now