开发者

Visual Studio 2010 and Cassini web server can't make windows authentication! (Access Denied 401.2)

How it could be difficult to make a web site which is integrated with domain authentication in visual studio!?

This is my web.config:

    <authentication mode="Windows"/>
    <identity imperso开发者_Go百科nate="true"/>
    <authorization>
        <allow users="xxxDomains\yyyGroup"/>
        <deny users="*"/>
    </authorization>

This is the result:

Visual Studio 2010 and Cassini web server can't make windows authentication! (Access Denied 401.2)

But I think there would be a logon dialog which is for entering domain_name\username and password. Bu page is directed me always to the Access Denied Page without asking my username and password.

PS: I'm not belong to any domain. I want to use visual studio's web server(cassini). I will deploy the site after finishing project, I don't want to deploy project to web server in every F5 ...

Any help would be appreciated...


I guess what you are missing is checking the box for NTML Authentification in your web projects properties under Servers in the Web tab.

Visual Studio 2010 and Cassini web server can't make windows authentication! (Access Denied 401.2)

Anyhow, I would recommend upgrading to IIS Express 7.5, which is a simple and self-contained version of IIS that is optimized for developers:

  • The way IIS Express treats Windows Authentication is the same as a "real" IIS instance.

  • You still have the comfort of a local development server (e.g. F5) without deploying.

  • The ASP.NET Development Server is not developed anymore by Microsoft and will be replaced by IIS Express in future releases of Visual Studio.

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

Hope this helps!


In solution explorer pane select the Web Project and hit F4. (not right click+properties, thats different)

In properties Pane set:
Windows Authentication: Enable
Anonymous Authentication: Disabled

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

To get Username:

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

Run your project, Happy Days!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜