错误 400 错误请求 - 单独重定向 [英] Error 400 Bad Request - individual redirect
问题描述
SEO 公司要求将每个 404 错误请求重定向到特定 url.我要求将错误 400(错误请求)重定向到特殊页面.
我可以在 web.config 文件中完成,但要求是每个 url 到特殊页面例如https://stackoverflow.com/questions/askhttps://stackoverflow.com/questions/ask =>(301) https://stackoverflow.com/questions/askhttps://stackoverflow.com/questionshttps://stackoverflow.com/questions => (301)https://stackoverflow.com/questions
有可能吗?我的应用程序是 IIS 服务器上的 ASP.NET(不是 MVC)
谢谢
在 asp.net webforms 上设置一个页面,即 Redirect.aspx 来重定向所有类型为 400 的错误:
<预><代码><配置><system.web><customErrors defaultRedirect="Error.htm"mode="RemoteOnly"><错误状态代码="400"重定向=重定向.aspx"/></customErrors></system.web>然后在页面上看到它来自的网址:
Request.UrlReferrer
然后相应地处理
The Seo Company ask for making redirect each 404 bad request to specific url. I asked for redirect an error 400 (Bad request) to special page.
I can do it in the web.config file, but the requirement is each url to special page for example https://stackoverflow.com/questions/askhttps://stackoverflow.com/questions/ask =>(301) https://stackoverflow.com/questions/ask https://stackoverflow.com/questionshttps://stackoverflow.com/questions => (301) https://stackoverflow.com/questions
Is it possible? My application is ASP.NET (Not MVC) on IIS SERVER
Thanks
On asp.net webforms set a page i.e. Redirect.aspx to redirect all the Error of type 400:
<configuration>
<system.web>
<customErrors defaultRedirect="Error.htm"
mode="RemoteOnly">
<error statusCode="400"
redirect="Redirect.aspx"/>
</customErrors>
</system.web>
then on the page see the Url it cames from by:
Request.UrlReferrer
then handle accordingly
这篇关于错误 400 错误请求 - 单独重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!