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

Cannot get Windows Authentication to work in my project

$
0
0

As I understand it, Windows Authentication is supposed to make it possible to fetch the domain and username of the currently-logged-on user. But I can't seem to get this to work. After I publish my project to my web server, and I load the page with a web browser:

If I use

Page.User.Identity.Name


in my code, then I get a blank string. If I try:

System.Security.Principal.WindowsIdentity.GetCurrent().Name

in my code, then I get "NT AUTHORITY\NETWORK SERVICE", which is obviously incorrect. 

In my project's web.config file under "<system.web>", it says

<authentication mode="Windows"></authentication>

...so I have every indication that WIndows Authentication is being set. So, what am I doing wrong?


Viewing all articles
Browse latest Browse all 4737

Trending Articles



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