Visual Studio 2010 and Cassini web server cannot authenticate with Windows! (Access Denied 401.2)

How can it be difficult to create a website integrated with domain authentication in visual studio !?

This is my web.config:

<authentication mode="Windows"/> <identity impersonate="true"/> <authorization> <allow users="xxxDomains\yyyGroup"/> <deny users="*"/> </authorization> 

This is the result:

alt text

But I think that there will be a login dialog , which is designed to enter domain_name\username and password . The Bu page always directs me to the access page without asking for my username and password.

PS: I do not belong to any domain. I want to use the visual studio web server (cassini). I’m spreading the site after the project is completed, I don’t want to deploy the project to the web server in each F5 ...

Any help would be appreciated ...

+4
source share
2 answers

I assume that you are missing the NTML Authentification checkbox in the properties of web projects in the Servers section of the Web tab.

enter image description here

In any case, I would recommend switching to IIS Express 7.5 , which is a simple and standalone version of IIS, optimized for developers

  • The IIS Express method relates to Windows authentication — it’s the same as the “real” IIS instance.

  • You still have the comfort of a local development server (such as F5 ) without deployment.

  • ASP.NET development server is no longer developed by Microsoft and will be replaced by IIS Express in future versions of Visual Studio.

See also Scott Guthrie's blog post for more information on IIS Express or this article .

Hope this helps!

+4
source

In the solution explorer pane, select a web project and press F4 . (do not right click + properties, these are different)

In the panel properties:
Windows Authentication : Enable
Anonymous Authentication : Disabled

In Web.config: <authentication mode="Windows"></authentication>

Get username:

 HttpContext.Current.User.Identity.Name OR User.Identity.Name 

Launch the Happy Days project.

+2
source

Source: https://habr.com/ru/post/1335218/


All Articles