页面访问错误转到你设置好的页面根据响应码,错误html页面放在根下,其它随意,配置web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
<customErrors mode="RemoteOnly" defaultRedirect="MyErrorPage.html"><!--mode="On"都跳转到错误页面,而remoteOnly是客户跳转到错误页面,而程序员是黄页-->
<error statusCode="403" redirect="NoAccess.html"/>
<error statusCode="404" redirect="FileNotFound.html"/>
<!--<error statusCode="500" redirect="ServerCsCodeError.html"/>-->
</customErrors>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<connectionStrings>
<add name="connStr" connectionString="server=.;database=MySqlDB;uid=sa;pwd=123;"/>
</connectionStrings>
</configuration>
见上的web.config的customErrors配置节的位置,敲试就能试出该节在哪个节下
属性:
mode="RemoteOnly" 有on 还有...

浙公网安备 33010602011771号