发布于 2016-06-11 07:46:18 | 159 次阅读 | 评论: 1 | 来源: 网友投递
ASP.NET
ASP.NET 是.NET FrameWork的一部分,是一项微软公司的技术,是一种使嵌入网页中的脚本可由因特网服务器执行的服务器端脚本技术,它可以在通过HTTP请求文档时再在Web服务器上动态创建它们。 指 Active Server Pages(动态服务器页面) ,运行于 IIS(Internet Information Server 服务,是Windows开发的Web服务器)之中的程序 。
<customErrors mode="On" defaultRedirect="404.aspx">
<error statusCode="403" redirect="404.aspx" />
<error statusCode="404" redirect="404.aspx" />
<error statusCode="400" redirect="404.aspx" />
</customErrors>
protected void Application_Error(object sender, EventArgs e)
{
//在出现未处理的错误时运行的代码
this.FileNotFound_Error();
}
/// <summary>
/// 404错误处理
/// </summary>
private void FileNotFound_Error()
{
HttpException erroy = Server.GetLastError() as HttpException;
if (erroy != null && erroy.GetHttpCode() == 404)
{
Server.ClearError();
string path = "~/404.aspx";
Server.Transfer(path);
//Context.Handler = PageParser.GetCompiledPageInstance(path, Server.MapPath(path), Context);
}
}