473,407 Members | 2,546 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,407 software developers and data experts.

Principal.IIdentity

We'd like to capture the windows account of the current web user. In our
code-behinds, this is cake using:

System.Security.Principal.IIdentity ii = User.Identity;
Reponse.Write("User: " + ii.Name);

However, we have a global error hander in the Global.asax Application_Error
event that it doesn't work so hot in. This is due to the fact that the User
class above is available only through the Page class. The global.asax isn't
a page, so it doesn't have access to User. Is there a way around this?

Note - we can't use WindowsPrincipal or WindowsIdentity because we're using
Impersonation to connect to SQL Server.
The WindowsPrincipal would give us the wrong user.

Thanks in advance!
Mark
Nov 18 '05 #1
2 1814
How about using a Session variable as the user first hits the site to store
the Identity. Then check the Session variable from within the Error Page if
it gets fired.

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:Oz**************@TK2MSFTNGP09.phx.gbl...
We'd like to capture the windows account of the current web user. In our
code-behinds, this is cake using:

System.Security.Principal.IIdentity ii = User.Identity;
Reponse.Write("User: " + ii.Name);

However, we have a global error hander in the Global.asax Application_Error event that it doesn't work so hot in. This is due to the fact that the User class above is available only through the Page class. The global.asax isn't a page, so it doesn't have access to User. Is there a way around this?

Note - we can't use WindowsPrincipal or WindowsIdentity because we're using Impersonation to connect to SQL Server.
The WindowsPrincipal would give us the wrong user.

Thanks in advance!
Mark

Nov 18 '05 #2
HttpContext.Current.User.Identity

Costas
"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:Oz**************@TK2MSFTNGP09.phx.gbl...
We'd like to capture the windows account of the current web user. In our
code-behinds, this is cake using:

System.Security.Principal.IIdentity ii = User.Identity;
Reponse.Write("User: " + ii.Name);

However, we have a global error hander in the Global.asax Application_Error event that it doesn't work so hot in. This is due to the fact that the User class above is available only through the Page class. The global.asax isn't a page, so it doesn't have access to User. Is there a way around this?

Note - we can't use WindowsPrincipal or WindowsIdentity because we're using Impersonation to connect to SQL Server.
The WindowsPrincipal would give us the wrong user.

Thanks in advance!
Mark

Nov 18 '05 #3

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

Similar topics

4
by: hazz | last post by:
If I successfully run a VS.NET app which includes the following; ************************** APP 1 **************************** m_iIdnt = new...
11
by: hazz | last post by:
is that possible from a C++ app? thank you. -Greg
2
by: Craig Buchanan | last post by:
I've integrated role-based, forms authentication in my ASP.net application. I have a few remaining issues that I hope to resolve. Here are some of my questions: 1). I would like to access...
6
by: Craig Buchanan | last post by:
I have an object, named SiteIdentity, that implements IIdentity. I have added additional properties to this class, Email for instance. I am using forms authentication. In the code behind class...
3
by: David B. Bitton | last post by:
For some odd reason, despite the fact that I assign my own custom IPrincipal to the HttpContext.User property in an HttpApplication.AuthenticateRequest event handler inside of an IHttpModule,...
2
by: lucd | last post by:
Hello, I am currently playing with form authentication & role based security on a web application. As seen in the starter kit Time tracker, I setup a custom identity class (CustomPrincipal)...
1
by: Amar | last post by:
I have a created 2 single signon projects that works fine, by using IIdentity, my stupid question is that how do i clear the User object. After the user navigates through the sites by clicking...
0
by: Mythran | last post by:
We have a class that Implements IPrincipal (System.Security.Principal.IPrincipal). We have a business logic class library assembly that checks the Principal object for role information to see if...
0
by: Mythran | last post by:
I have a custom Principal (implements System.Security.Principal.IPrincipal interface) that I need to access from a WebService. My web application has the Thread.CurrentPrincipal set to this new...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...

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.