MVC 自己创建URL 对象处理路径

var url = new UrlHelper(filterContext.RequestContext);

  var url = new UrlHelper(HttpContext.Current.Request.RequestContext); 

  url.Content(FormsAuthentication.LoginUrl) ;

 FormsAuthentication.LoginUrl='~/Login/Index'     

发布程序在虚拟目录下,css 中图片引用要用相对路径,页面中的图片或者请求地址则需要走MVC 路由,

原文地址:https://www.cnblogs.com/871735097-/p/5381800.html