如何在asp.net中创建404错误页面# [英] how to create 404 error page in asp.net c#
本文介绍了如何在asp.net中创建404错误页面#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请一些人告诉如何为asp.net c#web site创建404错误页面。请告诉我有什么步骤以及我应该为404错误页面添加什么代码。请帮助解决这个问题
Pls some one tell that how to create 404 error page for the asp.net c# web site.Pls some one tell that what are the steps and what code should i put for the 404 error page. Pls help to solve this problem
推荐答案
如何在asp.net中创建404错误页面c#
那里在404页面设计中没有什么特别之处。它只是另一个页面,可以包含您决定的任何内容。
在404响应期间,您的应用程序将显示指定的页面 - 可以是您指向的任何页面。因此,设计明智,在页面上有任何内容,从其中的简单文本开始 - 找不到文件。
关于如何配置在404期间显示的特定页面,您需要在asp.net Web应用程序的web.config文件中使用CustomError标记。
示例:
how to create 404 error page in asp.net c#
There is nothing specific in 404 page design. It''s just another page that can have whatever content you decide to.
During 404 response, your application would show the specified page - that can be any page you point to. So, design wise, have anything on page, start with a simple text in it - File not found.
On how to configure a specific page to be shown during a 404, you need to make use of CustomError tag in web.config file of your asp.net web application.
Example:
<customErrors mode="On">
<error statusCode="404" redirect="filenotfound.htm" />
</customErrors>
供参考的文章:
MS:显示自定义错误页面(C#) [ ^ ]
MS支持:如何使用Visual C#.NET在ASP.NET中创建自定义错误报告页面 [ ^ ]
这篇关于如何在asp.net中创建404错误页面#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文