根据ASP.NET路径/ URL自定义错误页 [英] Custom error pages based on path/URL in ASP.NET

查看:112
本文介绍了根据ASP.NET路径/ URL自定义错误页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 /板/ 目录中一些网页,有的在 /网站/ 目录。我需要两个不同的404页面根据他们的道路在这些网页上,因为这些目录有不同的母版页

I have some pages in /panel/ directory and some in /website/ directory. I need two different 404 pages for these pages based on their path, because these directories have different master pages.

当我在的web.config 文件中使用的customErrors ,它重定向所有页面一个404页,所以也没用对我来说。

when I use customErrors in web.config file, it redirects all pages to one 404 page so it's useless for me.

我该如何处理呢?我可以处理它的Global.asax 母版页还是什么?

How can I handle it? Can I handle it in global.asax or master pages or what?

感谢名单提前。

推荐答案

您可以创建更小的的web.config 与要覆盖的设置,或那些位置在根web.config指定多个的customErrors 位置标签中设置。

You can either create smaller web.config on those locations with the settings you want to override, or on the root web.config you specify the multiple customErrors settings inside location tags.

您不需要更改任何code这一点。

You don't need to change any code for this.

这篇关于根据ASP.NET路径/ URL自定义错误页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆