/// <summary>把~/niunantest.aspx转化成http://localhost:3212/ModuleTest/niunantest.aspx
///
/// </summary>
/// <param name="path">如:~/niunantest.aspx</param>
/// <returns></returns>
public static string GetVirsualURL(string path)
{
path = path.Replace("~","");
HttpRequest request = HttpContext.Current.Request;
string port = request.Url.Port == 80 ? "" : ":" + request.Url.Port.ToString();
if (request.ApplicationPath == "/")
{
return @"http://" + request.Url.Host + port+path;
}
else
{
return @"http://" + request.Url.Host + port + request.ApplicationPath+path;
}
}
///
/// </summary>
/// <param name="path">如:~/niunantest.aspx</param>
/// <returns></returns>
public static string GetVirsualURL(string path)
{
path = path.Replace("~","");
HttpRequest request = HttpContext.Current.Request;
string port = request.Url.Port == 80 ? "" : ":" + request.Url.Port.ToString();
if (request.ApplicationPath == "/")
{
return @"http://" + request.Url.Host + port+path;
}
else
{
return @"http://" + request.Url.Host + port + request.ApplicationPath+path;
}
}