Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpContext.Current.User.Identity.Name without Windows Authentication

Tags:

asp.net

iis-7

I had the problem of HttpContext.Current.User.Identity.Name coming through in my ASP.NET application as an empty string and found these references to resolve the issues;

HttpContext.Current.User.Identity.Name is Empty (which also took me to Scott Guthrie's blog.

I've disabled anonymous authentication and enabled windows authentication. I now get the domain user name. However the problem now is that I get the windows credentials prompt box prior to someone accessing my application. This was not how I intended for it to work.

Is there another setting that I can implement to get the domain creds of the currently logged in user without having to force the windows authentication prompt on my users?

Our ASP.NET application is pretty simple and takes this information, passing it onto a Silverlight application.

like image 782
GT. Avatar asked Feb 17 '26 00:02

GT.


1 Answers

You should get the credentials directly in IE and chrome. They pass the NTLM credentials directly.

If this doesn't work for you, place the web site in "Local Intranet" security group in Windows "Internet options".

Firefox is known to prompt for these by default. It does have a setting to enable it. But you would have to reply on a plugin if you want it to work without users have to go through their config.

like image 200
nunespascal Avatar answered Feb 20 '26 00:02

nunespascal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!