Response.TrySkipIisCustomErrors不工作 [英] Response.TrySkipIisCustomErrors not working

查看:578
本文介绍了Response.TrySkipIisCustomErrors不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,我希望页面返回404响应,但仍然在该网页。请不要问为什么 - 客户端希望它甚至后,我和他讨论过这种方式。

I have a page where i want the page to return a 404 response but remain on that page. Please don't ask why - the client wants it that way even after i discussed it with him.

我有写在C#.NET程序页面下运行IIS 8应用程序池配置为在4.0集成模式下运行。

I've got a .net page written in C# running under iis 8 and the app pool is configured to run under 4.0 integrated mode

当我在页面设置状态code至404,它被发送到的成立这个网站的自定义404错误页面。谷歌搜索后,我发现在SO另一篇文章提到使用Response.TrySkipIisCustomErrors。从我读它听起来像它正是我所需要的。我试着将它设置为true,它在页面的行为没有任何影响 - 仍然可以发送给客户的404错误页面这是设置在IIS

When i set the statuscode to 404 in the page, it gets sent to the custom 404 error page that's set up for this site. After googling i found another post on SO mention using Response.TrySkipIisCustomErrors. From what i read it sounds like it's exactly what i need. I tried setting it to true and it had no effect in the behavior of the page - still get sent to the customer 404 error page that's setup in iis.

任何人有这是为什么不工作的任何想法?

Anyone have any ideas why this isn't working?

推荐答案

啊 - 这是第一。第一次我设法找到打提交按钮之前的答案:)

Well - this is a first. First time I managed to find the answer before hitting the submit button :)

发现这个IIS.net文章:
<一href=\"http://www.iis.net/configreference/system.webserver/httperrors\">http://www.iis.net/configreference/system.webserver/httperrors
然后引导我找到这个:
<一href=\"http://msdn.microsoft.com/en-us/library/ms690576(v=vs.90).aspx\">http://msdn.microsoft.com/en-us/library/ms690576(v=vs.90).aspx

Found this IIS.net article: http://www.iis.net/configreference/system.webserver/httperrors which then lead me to find this: http://msdn.microsoft.com/en-us/library/ms690576(v=vs.90).aspx

向下滚动到解释什么 existingResponse 选项指的是一部分。我有我一套取代,这意味着它忽略 TrySkipIisCustomErrors 完全。它改变为自动,它的工作。

Scroll down to the part that explains what the options for existingResponse mean. I had mine set to replace which means it ignores TrySkipIisCustomErrors completely. Changed it to auto and it's working.

这篇关于Response.TrySkipIisCustomErrors不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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