hi all,

I was developing asp.net mvc4 web site. I think I have corrupted some configuration in web site by mistaken.
Now I got following error.

HTTP Error 401.2 - Unauthorized
You are not authorized to view this page due to invalid authentication headers.
Most likely causes:

    No authentication protocol (including anonymous) is selected in IIS.
    Only integrated authentication is enabled, and a client browser was used that does not support integrated authentication.
    Integrated authentication is enabled and the request was sent through a proxy that changed the authentication headers before they reach the Web server.
    The Web server is not configured for anonymous access and a required authorization header was not received.
    The "configuration/system.webServer/authorization" configuration section may be explicitly denying the user access.

Things you can try:

    Verify the authentication setting for the resource and then try requesting the resource using that authentication method.
    Verify that the client browser supports Integrated authentication.
    Verify that the request is not going through a proxy when Integrated authentication is used.
    Verify that the user is not explicitly denied access in the "configuration/system.webServer/authorization" configuration section.
    Check the failed request tracing logs for additional information about this error. For more information, click here.

when I run the web from visual studio it always goes to http://localhost:59227/Account/Login?ReturnUrl=%2f this page.
can someone give me a hint. I am new asp.net and visualstudieo ide

Recommended Answers

All 2 Replies

Most probably you have played with routing configuration and your defualt has been changed from home to account. Just go to global.asax and check the following:

public static void RegisterRoutes(RouteCollection routes)

                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

                new { controller = "ErrorController", action = "PageNotFound" }


should be matching.

no it was not that issue. I had to change project propertise under solution expolorar. there, I change annymous users enable option. then it started to work as notmal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.