2016-12-02 14 views
0

아래의 테스트 시나리오에서 오류 페이지로 이동하려면 http://localhost/admin800/test으로 리디렉션해야합니다. http://localhost/admin800/test :테스트 케이스 http : // localhost/test에 사용자 정의 오류 페이지 표시. htttp : // localhost/test :

여기

내 코드는,

<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    <httpRuntime targetFramework="4.0" /> 
    <customErrors mode="On" defaultRedirect="Error1"> 
     <error statusCode="404" redirect="/admin600/error.aspx"/> 
    </customErrors> 

    </system.web> 
    <system.webServer>  
     <directoryBrowse enabled="false" /> 
     <httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" existingResponse="Replace"> 
     <remove statusCode="500" subStatusCode="-1" /> 
     <remove statusCode="404" subStatusCode="-1" /> 
     <remove statusCode="403" subStatusCode="-1" /> 
     <error statusCode="404" path="/admin600/error.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="500" prefixLanguageFilePath="" path="/admin600/error.aspx" responseMode="ExecuteURL" /> 
     <error statusCode="403" path="/admin600/error.aspx" responseMode="ExecuteURL" /> 
     </httpErrors> 
    </system.webServer> 

제가 듣고 앞으로 MVC.Looking에없는 웹 응용 프로그램 프로젝트에서 프로젝트를 수행 한이 web.configI에 추가 할 필요가 어떤 추가 코드를 알려주십시오 너 가장 일찍.

미리 감사드립니다. 조지

나는이 내 응용 프로그램에서 코드 사용하고

답변

0

:

<customErrors defaultRedirect="error.aspx" mode="On" /> 또는이 :

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors>