ASP.NET MVC UrlHelper.GenerateUrl exception: “Cannot use a leading .. to exit above the top directory”
问题 I am using the IIS 7 Rewrite module to rewrite an incoming url like: http://server/year/all to http://server/application/controller/year/all Everything works fine, except when, while processing the rewritten request, I use MVC's UrlHelper.GenerateUrl() method: UrlHelper.GenerateUrl( "Assets", "Css", "Asset", new RouteValueDictionary(new { site = site.Name, assetPath = assetPath }), RouteTable.Routes, controllerContext.RequestContext, false); Calling this method results in an HttpException: