473,395 Members | 1,678 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.

Web.HttpContext.Current.User.Identity.Name is blank

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

Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?

Can someone please tell me why this could have happened? And how I can
prevent this?

Thanks,

db
Nov 18 '05 #1
4 17762
And it is put to the Context on every request i.e user is athenticated with
forms auth and then in Application_AuthenticateRequest you populate the
HttpContext with the Principal? I am asking because HttpContext is recreated
for every request which means that user details must also.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Dan Bart" <db********@yahoo.com> wrote in message
news:fa**************************@posting.google.c om...
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

Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?

Can someone please tell me why this could have happened? And how I can
prevent this?

Thanks,

db

Nov 18 '05 #2
Yes it is put in the Context on every request in Global.asax.vb

Thanks,

db
And it is put to the Context on every request i.e user is athenticated with
forms auth and then in Application_AuthenticateRequest you populate the
HttpContext with the Principal? I am asking because HttpContext is recreated
for every request which means that user details must also.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Dan Bart" <db********@yahoo.com> wrote in message
news:fa**************************@posting.google.c om...
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

Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?

Can someone please tell me why this could have happened? And how I can
prevent this?

Thanks,

db

Nov 18 '05 #3
Hi Dan,

I notice this behaviour too but only after the initial authentication
request. Subsequent requests contain the expected user name.

--
Cheers

Pete

XBOX Live Leagues & Tournaments
http://www.xboxracing.net/
"Dan Bart" <db********@yahoo.com> wrote in message
news:fa**************************@posting.google.c om...
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

Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?

Can someone please tell me why this could have happened? And how I can
prevent this?

Thanks,

db

Nov 18 '05 #4
To populate the LOGON_USER variable when you use any authentication mode
other than None, you can deny access to the Anonymous user in the
<authorization> section of the Web.config file and change the authentication
mode other then None.

NOTE: When you enable Anonymous authentication in conjunction with Windows
authentication <or> if you grant access to the Anonymous user in the
<authorization> section while you are using any authentication mode other
than None, other server variables such as AUTH_USER and REMOTE_USER (as well
as the HttpContext.Current.User.Identity.Name property) also return an
empty string. You can use the any of the above-mentioned resolutions to
populate these variables.

Please refer to this public article for any additional details:
306359 PRB: Request.ServerVariables("LOGON_USER") Returns Empty String in
http://support.microsoft.com/?id=306359

HtH,
Andrea

--
This posting is provided "AS IS" with no warranties, and confers no rights.

"Pete" <pete denness a-t qsadotcodotuk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Dan,

I notice this behaviour too but only after the initial authentication
request. Subsequent requests contain the expected user name.

--
Cheers

Pete

XBOX Live Leagues & Tournaments
http://www.xboxracing.net/
"Dan Bart" <db********@yahoo.com> wrote in message
news:fa**************************@posting.google.c om...
I am using an application which is a modification of IBuySpy Portal.
It is using Forms authentication. Users login and their name is addedcontext that the code is running under. Context.User.Identity is the
user that asp.net recognizes - and this is not always the same. In
particular, if impersonation is off you'll get the app pool identity (or
ASPNET in IIS5) for WindowsIdentity; User.Identity will give the user name
regardless of impersonation.
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

Web.HttpContext.Current.User.Identity.Name was blank. Which should not
have been possible?

Can someone please tell me why this could have happened? And how I can
prevent this?

Thanks,

db


Nov 18 '05 #5

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

Similar topics

0
by: Giovanni Bassi | last post by:
Hello Group, I using impersonation on my web app. I am explicitely setting the User with the identity element in the web.config like this: <identity impersonate="true" userName="MyUsr"...
10
by: kiran_s_rao | last post by:
I have a serious issue that seems to be intermittent with User.Identity.Name. In an environment where about 100+ users are logging on to a site with forms authentication, calling ...
1
by: vvenk | last post by:
Hello: I am trying to initialize a User object at application start: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application is started Dim loOutcome...
2
by: nalbayo | last post by:
what's the difference between HttpContext.Current.User.Identity.Name; and Context.User.Identity.Name; thanks!
6
by: Sjaakie | last post by:
Hi, Is HttpContext.Current.User unique for each visitor or is it shared across an application? Have some problems that might have to do with this and found contradictory answers on this...
0
by: D-Someone | last post by:
We have an active directory user that just had her username renamed. When the user is running an application that calls our CurrentUser web service method (which returns the value of...
2
by: Abraham Andres Luna | last post by:
hello everyone, does anyone know why i can't access the HttpContext.Current.User.Identity.Name property in a .cs file? this is the index.aspx page: <%@ Page Language="C#" %> <script...
4
by: Doogie | last post by:
Hi, I am using HttpContext.Current.User.Identity.Name to get a user id from a web application. I then use that as part of a name of a cookie I'm writing. 30 minutes later I do a refresh of this...
0
by: =?Utf-8?B?QW50b25pbyBPJydOZWFs?= | last post by:
We changed a username in AD. The user now logs on to a computer on our network using the new username without any problems. They can not logon using the old username. However, when they access a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.