当前位置:  开发笔记 > 后端 > 正文

ASP.NET URL验证

如何解决《ASP.NETURL验证》经验,为你挑选了0个好方法。

我们在ASP.NET上有一个自定义REST处理程序,它配置如下,以处理所有传入的请求:


但是,传递一个管道字符,正确编码或根本不编码,会触发一个似乎来自ASP.NET内部的验证错误.

访问http://localhost:8080/%7chttp://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.

有任何想法吗?

推荐阅读
惬听风吟jyy_802
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有