类中使用ResolveUrl
1>获取当前page然后调用ResolveUrl
System.Web.UI.Page page = HttpContext.Current.CurrentHandler as System.Web.UI.Page;
String url=page.ResolveUrl("url");
2>VirtualPathUtility.ToAbsolute
System.Web.VirtualPathUtility.ToAbsolute("~/path")
程序员的基础教程:菜鸟程序员
|
请发表评论