473,804 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User.Identity.N ame 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="Syst em.Security"/>

<authenticati on mode="Windows"/>
<authorizatio n>
<deny users="?"/>
</authorization>

The test.aspx file is coded as follows:
Dim User As System.Security .Principal.IPri ncipal
User = System.Web.Http Context.Current .User
Label1.Text = "Label 1 Windows User Name: " & User.Identity.N ame

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

I'm not getting any errors but I'm not getting any results either. The
User.Identity.N ame 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 4726
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="Syst em.Security"/>

<authenticati on mode="Windows"/>
<authorizatio n>
<deny users="?"/>
</authorization>

The test.aspx file is coded as follows:
Dim User As System.Security .Principal.IPri ncipal
User = System.Web.Http Context.Current .User
Label1.Text = "Label 1 Windows User Name: " & User.Identity.N ame

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

I'm not getting any errors but I'm not getting any results either. The
User.Identity.N ame 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*******@gmai l.comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.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="Syst em.Security"/>

<authenticati on mode="Windows"/>
<authorizatio n>
<deny users="?"/>
</authorization>

The test.aspx file is coded as follows:
Dim User As System.Security .Principal.IPri ncipal
User = System.Web.Http Context.Current .User
Label1.Text = "Label 1 Windows User Name: " & User.Identity.N ame

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

I'm not getting any errors but I'm not getting any results either. The
User.Identity.N ame 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
3053
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 content based on the user's role. I wrote this to do it: if (HttpContext.Current.User.Identity.IsAuthenticated) { plLoggedIn.Visible = true;
4
17803
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: Web.HttpContext.Current.User.Identity.Name to write audit trail as to what users do. Now recently on one of the activities I noticed that the
4
3136
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 VS.net doesn't like the User.IsInRole("domain"); With the error "type or namspace for User not found". I can't work out which reference i'm missing! Basically the idea is to create a auth component that is called for
8
9480
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 System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
15
2928
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 login id in other forms of the app. I will eventually save a record to a SQL database, and I want the login id to be automatically entered in a field on a form other than the login page. Help.
3
1779
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 User.Identity.Name ! But i want to pass(the current user) to a table in DB! I was thinking of ussing hidden textboxes like so :- Is it a good approach.. Any ideas appreciated!
3
2630
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 the user control i have created for navigation. However, the user object does not appear to be available. Is there a way around this? or am i doing something wrong? (additional note: i also tried putting it in the global.asax but get an error.)...
3
8960
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 current user to a role like so: <script runat="server"> void Page_Load()
4
5815
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 article: http://support.microsoft.com/?id=306158#4 This doesn't work in Windows 2008 Server, we receive the following exception:
0
9712
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10089
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.