当前位置:编程学习 > C#/ASP.NET >>

C#实现设置完整虚拟路径

//路径访问绝对地址
string servername = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
string port = HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
StringBuilder mHttpUrl = new StringBuilder();
mHttpUrl.Append("http://");
mHttpUrl.Append(servername);
if (port.Length > 0)
{
    mHttpUrl.Append(":");
    mHttpUrl.Append(port);
}
string mServerName = "~/AppModules/Archives/HTMLIMAGE/index.htm";
mHttpUrl.Append(this.Page.ResolveUrl(mServerName));

    
补充:软件开发 , C# ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,