Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

System.Threading.Thread.CurrentPrincipal hit Object reference is not set exception

$
0
0

Hi

All the while,I am using System.Threading.Thread.CurrentPrincipal to retrieve user name and domain to automate some security activity. I am using this in my generic library which might be used in Web and Windows environment as well. It was working well .. till.. 

My customer installed my web app to server, and have "Windows Authentication" enabled in IIS.

My web app allow SSO which user does't not required to logon to my application anymore once they login to Windows domain. Then I need to retrieve logon user name and domain, to retrieve my application security permission info (simulate login)

However, I hit error as subject when my code try to access System.Threading.Thread.CurrentPrincipal. After some troubelshooting, I able to solve it by using HttpContext.Current.User.Identity.

My question is

1. What could cause System.Threading.Thread.CurrentPrincipal suddenly hit exception?

2. Any better class/object to provide logon user's user name and domain which work in both win/web environment?

Thank you


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>