ASP.NET URL验证 [英] ASP.NET URL validation
问题描述
我们对ASP.NET自定义REST处理程序被配置这样来处理所有传入的请求:
We have a custom REST handler on ASP.NET that is configured like this to handle all incoming requests:
<add path="*" verb="*" type="REST.RESTProtocolHandler"/>
然而,传递一个管道字符,正确连接codeD或根本没有,触发器似乎来自内部ASP.NET验证错误。
However, passing it a pipe character, properly encoded or not at all, triggers a validation error that seems to come from inside ASP.NET.
访问的http://本地主机:8080 /%7C
或的http://本地主机:8080 / |
产生这个错误:
[ArgumentException的:路径中具有非法字符]
System.IO.Path.CheckInvalidPathChars(字符串路径)7489125
System.IO.Path.Combine(PATH1字符串,字符串PATH2)+ 40
System.Web.Configuration.UserMapPath.GetPhysicalPathForPath(字符串路径,VirtualDirectoryMapping映射)+114
System.Web.Configuration.UserMapPath.GetPathConfigFilename(字符串的siteID,VirtualPath路径,字符串和放大器;目录,字符串&安培; baseName的)+72
System.Web.Configuration.UserMapPath.MapPath(字符串的siteID,VirtualPath路径)+30
System.Web.Configuration.UserMapPath.MapPath(字符串的siteID,字符串路径)+31
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath,布尔permitNull)+297
System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath,布尔permitNull)+51
System.Web.CachedPathData.GetConfigPathData(字符串用configPath)+341
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath,布尔permitPathsOutsideApp)+110
System.Web.HttpContext.GetFilePathData()+36
System.Web.HttpContext.GetConfigurationPathData()+26
System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext的背景下)+43
System.Web.Configuration.CustomErrorsSection.GetSettings(HttpContext的背景下,布尔canThrow)+41
System.Web.Htt presponse.ReportRuntimeError(例外五,布尔canThrow,布尔localExecute)+101
System.Web.HttpRuntime.FinishRequest(WR的HttpWorkerRequest,HttpContext的背景下,例外五)383
[ArgumentException: Illegal characters in path.] System.IO.Path.CheckInvalidPathChars(String path) +7489125 System.IO.Path.Combine(String path1, String path2) +40 System.Web.Configuration.UserMapPath.GetPhysicalPathForPath(String path, VirtualDirectoryMapping mapping) +114 System.Web.Configuration.UserMapPath.GetPathConfigFilename(String siteID, VirtualPath path, String& directory, String& baseName) +72 System.Web.Configuration.UserMapPath.MapPath(String siteID, VirtualPath path) +30 System.Web.Configuration.UserMapPath.MapPath(String siteID, String path) +31 System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +297 System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath, Boolean permitNull) +51 System.Web.CachedPathData.GetConfigPathData(String configPath) +341 System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +110 System.Web.HttpContext.GetFilePathData() +36 System.Web.HttpContext.GetConfigurationPathData() +26 System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext context) +43 System.Web.Configuration.CustomErrorsSection.GetSettings(HttpContext context, Boolean canThrow) +41 System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute) +101 System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e) +383
没有用户空间code被执行。这是什么地方配置选项?转载于IIS 7安培; VS Studio的2008 DEVEL服务器。
No userland code gets executed. Is this a configuration option somewhere? Reproduced on IIS 7 & VS Studio's 2008 devel server.
堆栈溢出似乎处理这个错误行,它看起来像一个动态生成的404 MVC页获取呈现为 http://stackoverflow.com/% 7C 。
Stack Overflow seems to handle this error OK, it looks like a dynamically generated 404 MVC page gets rendered for http://stackoverflow.com/%7c.
任何想法?
推荐答案
-
首先,你需要在鼓捣
注册地:
First you need to tinker in the Registry :
http://support.microsoft.com/default。 ?ASPX SCID = KB; EN-US; 826437
重新启动IIS
和瞧它的工作原理。
但我做了这个工作,IIS7没有问题,但随着IIS6我得到这个错误(路径中具有非法字符)。
But i've made this work with IIS7 without problems, but with IIS6 I get this error (Illegal characters in path).
这篇关于ASP.NET URL验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!