ASP.NET - 如何处理programmaticaly损坏的网址与点的字符结束? [英] ASP.NET - How to handle programmaticaly broken URLs ended with dot characters?
问题描述
我们的应用程序获取用碎URL的请求与点字符,即结束/〔实施例。 ,/示例..等不时。至于现在,这种要求结束与标准的IIS 404错误(服务器在'/'应用程序。错误),这是默认的行为,似乎没有达到ASP.NET应用程序在所有。由于某种原因,我需要设置IIS这样的请求传递到应用程序,他们应该在一个自定义的方式进行处理。有什么办法来实现这一目标?
Our application gets requests with broken URLs ended with dot character, i.e. "/examle." , "/example..", etc. from time to time. As for now, such requests end up with standard IIS 404 error ("Server Error in '/' Application."), which is default behavior, and seem not to reach ASP.NET application at all. By some reason I need to set IIS to pass such requests to the application, where they should be handled in a custom way. Is there any way to achieve this?
我们使用ASP.NET Web窗体,IIS 7和.NET Framework 4
We use ASP.NET Web Forms, IIS 7 and .NET Framework 4
推荐答案
创建错误404自定义页面,例如404.aspx并在web.config中decalre吧:
Create custom page for error 404, for example 404.aspx and decalre it in web.config:
<system.webServer>
.
.
.
<httpErrors>
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" path="/404.aspx" prefixLanguageFilePath="" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>
如果你是OND点问题可以是固定的.NET 4.0或更高版本使用此设置:
And dot problem can be fixed if you are ond .NET 4.0 or later with this setting:
<httpRuntime relaxedUrlToFileSystemMapping="true" />
这篇关于ASP.NET - 如何处理programmaticaly损坏的网址与点的字符结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!