본문 바로가기

asp.net MVC

[Solution]HTTP Error 401.0 - Unauthorized

Asp.net 를 개발중에 간혹 설정이 미흡하면 아래와 같은 오류페이지를 마주하게 된다.

'HTTP Error 401.0 - Unauthorized' error Page

경우에 따라, IIS에서 설정하는 방법도 있지만, 제 경우는 아래와 같이 처리하였습니다.

[Your Soultion] -> Open 'Web.config' file

<system.web>
    <compilation debug="true" targetFramework="4.8" />
    <httpRuntime targetFramework="4.8" />
  </system.web>

<system.web> ~</system.web> 사이에 아래 코드를 추가한다.

  <authentication mode="Forms">
    <forms loginUrl="{your login path}" timeout="30" />
  </authentication>

ex > your login path : ~/Auth/Login

 

이렇게 설정 후 다시 빌드 후 실행하면 오류는 해결됩니다.