1
我找不到一個通用的方式來從asp.net路由請求中獲取「真正的/未路由的」url。反向查找一個asp.net路由的url
從
http://www.mysite.com/news/today
得到:
http://www.mysite.com/news.aspx?date=today
我的代碼loooks,如:
var currentUrl = HttpContext.Current.Request.Url;
//if url routing is used
if (HttpContext.Current.Request.RequestContext.RouteData!=null)
{
currentUrl = ???
}
我試着用GetVirtualPath
但有時也與Microsoft.AspNet.FriendlyUrls
Request.RequestContext.RouteData.Route.GetVirtualPath(Request.RequestContext,Request.RequestContext.RouteData.Values)