Vikram Avadhaani
Vikram Avadhaani

Reputation: 131

Authentication mode=windows not working

I am newbie to ASP.NET. I have an ASP.NET MVC 4 application from which I am trying to get the current loggedOn user using HttpContext. this is not running under IIS, but under FileSystem (as in running locally from Visual Studio 2012). I have set

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

and still I do not get the loggedOn user.

Then I tried with:

<deny users="?"/>

Gives me access denied error, even though I have admin rights on my computer.

can somebody help in getting loggedOn userName through HttpContext?

Upvotes: 3

Views: 4785

Answers (1)

Vikram Avadhaani
Vikram Avadhaani

Reputation: 131

found the solution in the settings of the project created. also found that, by default for a MVC 4->Single Page/Internet/Mobile Application the Anonymous Authentication will be enabled and Windows Authentication is Disabled. Changing the settings for Anonymous Authentication as Disabled and Enabling Windows Authentication did the trick.

(seriously, this was dumb behavior at its best :'( )

Upvotes: 6

Related Questions