473,412 Members | 3,860 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,412 software developers and data experts.

Unable to get Context.User.Identity.Name

Hi,

I try to get the 'Context.User.Identity.Name' from inside the global.asax in
the 'Application_BeginRequest' event.

I get this error message:
Object reference not set to an instance of an object.

You can simple test this with:
Response.Write(Context.User.Identity.Name);

How can I get there the name?

Thanks!
Nov 19 '05 #1
3 3301
The identity of the user has not been established when
Application_BeginRequest executes. If you need to access User.Identity,
you'll need to choose another event later in the request's life cycle.

I recommend reading the following document from the Patterns & Practices
site. It should give you a pretty thorough understanding of the life cycle
for an HTTP Request as it relates to ASP.NET.

http://msdn.microsoft.com/library/de...SecNetAP04.asp

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Arjen" <bo*****@hotmail.com> wrote in message
news:de**********@news5.zwoll1.ov.home.nl...
Hi,

I try to get the 'Context.User.Identity.Name' from inside the global.asax
in the 'Application_BeginRequest' event.

I get this error message:
Object reference not set to an instance of an object.

You can simple test this with:
Response.Write(Context.User.Identity.Name);

How can I get there the name?

Thanks!

Nov 19 '05 #2
Hi,

I know the problem, not the solution. I can't find the correct and first
event to get the User.Identity.
Can someone help?

Thanks!

"Dave Fancher" <da**@remove.davefancher.com> schreef in bericht
news:Q6********************@comcast.com...
The identity of the user has not been established when
Application_BeginRequest executes. If you need to access User.Identity,
you'll need to choose another event later in the request's life cycle.

I recommend reading the following document from the Patterns & Practices
site. It should give you a pretty thorough understanding of the life
cycle for an HTTP Request as it relates to ASP.NET.

http://msdn.microsoft.com/library/de...SecNetAP04.asp

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Arjen" <bo*****@hotmail.com> wrote in message
news:de**********@news5.zwoll1.ov.home.nl...
Hi,

I try to get the 'Context.User.Identity.Name' from inside the global.asax
in the 'Application_BeginRequest' event.

I get this error message:
Object reference not set to an instance of an object.

You can simple test this with:
Response.Write(Context.User.Identity.Name);

How can I get there the name?

Thanks!


Nov 19 '05 #3
I think I found it:
Application_PreRequestHandlerExecute

Arjen

"Arjen" <bo*****@hotmail.com> schreef in bericht
news:de**********@news6.zwoll1.ov.home.nl...
Hi,

I know the problem, not the solution. I can't find the correct and first
event to get the User.Identity.
Can someone help?

Thanks!

"Dave Fancher" <da**@remove.davefancher.com> schreef in bericht
news:Q6********************@comcast.com...
The identity of the user has not been established when
Application_BeginRequest executes. If you need to access User.Identity,
you'll need to choose another event later in the request's life cycle.

I recommend reading the following document from the Patterns & Practices
site. It should give you a pretty thorough understanding of the life
cycle for an HTTP Request as it relates to ASP.NET.

http://msdn.microsoft.com/library/de...SecNetAP04.asp

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Arjen" <bo*****@hotmail.com> wrote in message
news:de**********@news5.zwoll1.ov.home.nl...
Hi,

I try to get the 'Context.User.Identity.Name' from inside the
global.asax in the 'Application_BeginRequest' event.

I get this error message:
Object reference not set to an instance of an object.

You can simple test this with:
Response.Write(Context.User.Identity.Name);

How can I get there the name?

Thanks!



Nov 19 '05 #4

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

Similar topics

2
by: John Kraft | last post by:
I'm attempting to use the context.user object. In my login code, I add an identity to the context.user. I can use the debugger to watch it stuff the identity into the context.user object, but...
10
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able...
2
by: nalbayo | last post by:
what's the difference between HttpContext.Current.User.Identity.Name; and Context.User.Identity.Name; thanks!
3
by: tshad | last post by:
I am playing with GenericPrincipal classes and am using a sample program to test it. The problem is that even though I set the roles (which shows the roles in the Context.User as being there),...
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
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
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...
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
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...
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.