简体   繁体   中英

intranet windows authentication with with custom login page in ASP.NET MVC

We have ASP.NET MVC application with intra and internet user(Windows authentication). if user open application within intranet, need to auto login. Else need to show custom login page where we will manually authenticate. (Currently it show 401 prompt due to ntlm negotiate).

Is there a way to show custom login page on ntlm 401. we tried iis error page, application_endrequest and webconfig(error page). Nothing works out.

In Asp.Net MVC you can create custom Error Pages with your own defined html layout in web.config like this:

 <!--IIS Custom Errors-->
   <httpErrors errorMode="Custom" existingResponse="Replace">
      <remove statusCode="404" />
      <error statusCode="404" path="/CustomErrors/404.html" responseMode="ExecuteURL" />
      <remove statusCode="500" />
      <error statusCode="500" path="/CustomErrors/500.html" responseMode="ExecuteURL" />
    </httpErrors>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM