我们在ASP.NET上有一个自定义REST处理程序,它配置如下,以处理所有传入的请求:
但是,传递一个管道字符,正确编码或根本不编码,会触发一个似乎来自ASP.NET内部的验证错误.
访问http://localhost:8080/%7c
或http://localhost:8080/|
产生此错误:
[ArgumentException: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)+383Web.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)+383Web.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例外e)+383例外e)+383
没有用户区代码被执行.这是一个配置选项吗?在IIS 7和VS Studio的2008开发服务器上重现.
Stack Overflow似乎处理这个错误确定,它看起来像一个动态生成的404 MVC页面被渲染 https://stackoverflow.com/%7c.
有任何想法吗?