473,395 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

User.Identity.Name is blank

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.

Oct 9 '06 #1
2 4700
Use WindowsIdentity.GetCurrent()
or read this article
http://safari.informit.com/0735618909/app25
--
Milosz Skalecki
MCP, MCAD
"John" wrote:
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.

Oct 9 '06 #2
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.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
"John" <sd*******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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.

Oct 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jesper Stocholm | last post by:
I have implemented role-based security within my ASP.Net application. However, it seems the role is not passed to the authentication ticket I create. I want to use it to display/hide some...
4
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: ...
4
by: Mark | last post by:
hey, i'm trying to get the current windows user and the groups they are in. Intergrated windows auth on and annoymous access turned off on IIS. However when trying to compile the following code...
8
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As...
15
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the...
3
by: Patrick Olurotimi Ige | last post by:
How can i send LOGON_USER or User.Identity.Name to the Database? I'm working on a survey which is intranet based with Windows Authentication. I can get the current user by calling LOGON_USER or...
3
by: WebBuilder451 | last post by:
I've created a simple function to capture the userid when a page is hit. I can include this function in the page load using if not ispostback, but i'd perfer to place it in the page load event of...
3
by: =?Utf-8?B?Q2hhcmxlc0E=?= | last post by:
hi folks, I've got XP pro service pack 2 VS 2005 TSE with ASP.net 2.0 and C# I'm doing an example from Stephen Walther's so far excellent book and he has a whole load of stuff to add the...
4
by: =?Utf-8?B?QXZhRGV2?= | last post by:
ASP.Net 2. We are migrating to Windows 2008 64 bit Server with IIS 7 from Windows 2003 32 Bit with IIS 6. A few library classes we wrote uses impersonation in code like explained in this...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.