我试图在ASP.net MVC中点击ID为CON的URL。
路由
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }// Parameter defaults
);
发出以下错误
2015-04-29 08:25:22,325 [8] FATAL Myapplication.Global - Application ERROR === (null)
System.Web.HttpException (0x80004005)
at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath)
at System.Web.CachedPathData.GetConfigPathData(String configPath)
at System.Web.HttpContext.GetFilePathData()
at System.Web.HttpContext.GetRuntimeConfig()
at System.Web.HttpContext.get_ImpersonationToken()
at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError)
at System.Web.ThreadContext.AssociateWithCurrentThread(Boolean setImpersonationContext)
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
答案 0 :(得分:2)
有几个保留的关键字,如CON,PRN,NUL等(我相信这些保留在Windows操作系统系列中是为了向后兼容)。只需添加到您的web.config:
<system.web>
<httpRuntime relaxedUrlToFileSystemMapping="true"/>
......
</system.web>
应该解决这个问题。