asp net 自定义错误 defaultRedirect 更改大小写
在 ASP Net 3.5 Web 应用程序上,我有 defaultRedirect="Views/Shared/Error.aspx"。我的网站名称是“XXX”。
由于某种原因,当检测到错误时,搜索到的错误页面是“https://www.xxx.com/Views/Shared/Error.aspx”并抛出错误,因为我的页面位于反向代理后面区分大小写。是的,对错误页面的调用应该是“https://www.XXX.com/Views/Shared/Error.aspx”
有没有办法指定 ASP net 调用应该区分大小写???
提前致谢
on an ASP Net 3.5 web app I have defaultRedirect="Views/Shared/Error.aspx". The name of my web site is "XXX".
For some reason, when an error is detected, the error page searched is "https://www.xxx.com/Views/Shared/Error.aspx" and it throws an error, because my page is behind a reverse proxy which is case sensitive. It is, the call to the error page should be "https://www.XXX.com/Views/Shared/Error.aspx"
Is there a way to specify to ASP net that the call should be case sensitive???
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们的 .Net 站点在反向代理服务器(区分大小写)后面运行时遇到了类似的问题。修复结果是在设置中添加前导“~/”。
因此,在您的情况下,这将是:
defaultRedirect="~/Views/Shared/Error.aspx"
We were having a similar problem with our .Net site running behind a reverse proxy server (that was case sensitive). The fix turned out to be adding a leading "~/" to the setting.
So in your case, that would be:
defaultRedirect="~/Views/Shared/Error.aspx"
您是说您的代理对域名区分大小写吗?
无法在 ASP.NET 中启用域名区分大小写,因为域名不应该区分大小写。
可能可以为此构建一个拼凑,因为重定向只是一个位置标头和一个状态代码 301。但是,这不是您启用的设置。您必须构建自己的错误处理脚本。
Are you saying your proxy is case-sensitive as to the domain name?
There is no way to enable case-sensitivity for the domain name in ASP.NET as domain names are not supposed to be case sensitive.
It might be possible to build a kludge for this because a redirect is simply a Location header and a status code 301. However, it's not a setting that you enable. You'd have to build your own error handling script.