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

Principal/Identity questions

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 the Identity properties from within a web
custom control. It appears that the HTTPcontext is not available. What is
the 'proper' way to access the Identity info in this situation?

2). Is there a way to add additional Properties to the Identity object
such that they are available in the
Threading.Thread.CurrentPrincipal.Identity hierarchy?

3). Can someone explain in laymans terms what the Principal and Identity
objects are?

Thanks,

Craig Buchanan
Nov 18 '05 #1
2 1416
Answers inline:

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
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 the Identity properties from within a web
custom control. It appears that the HTTPcontext is not available. What is the 'proper' way to access the Identity info in this situation?
You should access HttpContext.Current when you need the context in a control
or something like that.
2). Is there a way to add additional Properties to the Identity object
such that they are available in the
Threading.Thread.CurrentPrincipal.Identity hierarchy?
You can't add properties to the Identity, but you can create your own
Principal which has as many properties as you like. Just derive from
GenericPrincipal and start adding properties.
3). Can someone explain in laymans terms what the Principal and Identity objects are?


I think that the Identity is who is making the request, but the Principal is
who is making the request and what they're allowed to do. Note that you use
User.IsInRole, not User.Identity.IsInRole.
--
John Saunders
John.Saunders at SurfControl.com
Nov 18 '05 #2
Answers inline:

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
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 the Identity properties from within a web
custom control. It appears that the HTTPcontext is not available. What is the 'proper' way to access the Identity info in this situation?
You should access HttpContext.Current when you need the context in a control
or something like that.
2). Is there a way to add additional Properties to the Identity object
such that they are available in the
Threading.Thread.CurrentPrincipal.Identity hierarchy?
You can't add properties to the Identity, but you can create your own
Principal which has as many properties as you like. Just derive from
GenericPrincipal and start adding properties.
3). Can someone explain in laymans terms what the Principal and Identity objects are?


I think that the Identity is who is making the request, but the Principal is
who is making the request and what they're allowed to do. Note that you use
User.IsInRole, not User.Identity.IsInRole.
--
John Saunders
John.Saunders at SurfControl.com
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
1
by: Jon | last post by:
Hello all, just a quick question to clarify. What's the difference between SitePrincipal and SiteIdentity? Thanks, J
2
by: Mark | last post by:
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: " +...
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)...
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: M# | last post by:
Hi everyone, I'm using WCF authentication services in my current project. I used the following information as a starting point: http://msdn.microsoft.com/en-us/library/bb398990.aspx ...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.