User.Identity.Name is blank

J

John

Help!

I've just spend the last three days researching and testing the
following issue without any results.

I have a test page setup to get the Windows logon name of the user.

The site is a private intranet with the following configuration:

Two Windows 2003 servers, load balanced. IIS 6.0 is running on both
servers. The default directory containing the files for the site is
located on a third server with a RAID array. On both Windows 2003
servers, IIS has anonymous access is unchecked and Integrated Windows
authentication is checked. SQL Server is also on the located on the
RAID array box but is not being used in this test.

The part of my web.config file that is applicable is as follows:
<add namespace="System.Security"/>

<authentication mode="Windows"/>
<authorization>
<deny users="?"/>
</authorization>

The test.aspx file is coded as follows:
Dim User As System.Security.Principal.IPrincipal
User = System.Web.HttpContext.Current.User
Label1.Text = "Label 1 Windows User Name: " & User.Identity.Name

Dim UserName As String
UserName = User.Identity.Name
Response.Write("Windows User Name: " & UserName)

I'm not getting any errors but I'm not getting any results either. The
User.Identity.Name is blank.

I think this may have something to do with the multiple server setup.
As a test, I setup a new website on one of the IIS servers with the
website files on the same server (not on the server with RAID array).
I used the exact same code and this time it prompted me for a Windows
logon - even though I was already logged into Windows. Once I logged
into Windows, my test.aspx page displayed my login name correctly.

I'm at a loss as to what to try next. I need to be able to
automatically detect the user without any type of login prompt. Any
ideas?

Thanks in advance.
 
C

Cowboy \(Gregory A. Beamer\)

Do you have the same session state settings in the config file?
Do you have the same machine keys set on both servers?

Either could cause a website user identification failure in a clustering
environment.
 

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,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top