C# ASP.NET中基于路径/URL的自定义错误页

C# ASP.NET中基于路径/URL的自定义错误页,c#,asp.net,web-config,http-status-code-404,global-asax,C#,Asp.net,Web Config,Http Status Code 404,Global Asax,我在/panel/目录中有一些页面,在/website/目录中有一些页面。基于路径,我需要两个不同的404页面用于这些页面,因为这些目录具有不同的母版页 当我在web.config文件中使用customErrors时,它会将所有页面重定向到一个404页面,因此对我来说毫无用处 我怎么办?我可以在global.asax或母版页中处理它吗 Thanx。要处理Global.asax文件中的错误,请执行以下操作: void Application_Error(object sender, EventAr

我在
/panel/
目录中有一些页面,在
/website/
目录中有一些页面。基于路径,我需要两个不同的404页面用于这些页面,因为这些目录具有不同的
母版页

当我在
web.config
文件中使用
customErrors
时,它会将所有页面重定向到一个404页面,因此对我来说毫无用处

我怎么办?我可以在
global.asax
母版页
中处理它吗


Thanx。要处理Global.asax文件中的错误,请执行以下操作:

void Application_Error(object sender, EventArgs e)
 { Exception exc = Server.GetLastError(); 
if (exc is HttpUnhandledException) 
{ // Pass the error on to the error page.
 Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax", true); } }

查看此文件了解更多信息

要处理Global.asax文件中的错误:

void Application_Error(object sender, EventArgs e)
 { Exception exc = Server.GetLastError(); 
if (exc is HttpUnhandledException) 
{ // Pass the error on to the error page.
 Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax", true); } }

查看此文件了解更多信息

要处理Global.asax文件中的错误:

void Application_Error(object sender, EventArgs e)
 { Exception exc = Server.GetLastError(); 
if (exc is HttpUnhandledException) 
{ // Pass the error on to the error page.
 Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax", true); } }

查看此文件了解更多信息

要处理Global.asax文件中的错误:

void Application_Error(object sender, EventArgs e)
 { Exception exc = Server.GetLastError(); 
if (exc is HttpUnhandledException) 
{ // Pass the error on to the error page.
 Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax", true); } }

查看此文件以了解更多信息

您可以在具有要覆盖的设置的位置上创建较小的
web.config
,或者在根web.config上指定
位置
标记内的多个
自定义错误
设置


您不需要为此更改任何代码。

您可以在具有要覆盖的设置的位置上创建较小的
web.config
,或者在根web.config上指定
位置
标记中的多个
自定义错误
设置


您不需要为此更改任何代码。

您可以在具有要覆盖的设置的位置上创建较小的
web.config
,或者在根web.config上指定
位置
标记中的多个
自定义错误
设置


您不需要为此更改任何代码。

您可以在具有要覆盖的设置的位置上创建较小的
web.config
,或者在根web.config上指定
位置
标记中的多个
自定义错误
设置

您不需要为此更改任何代码