/// <summary>
/// 获得请求页面的完整Url
/// </summary>
/// <param name="httpRequest">httpRequest对象</param>
/// <param name="server">HttpServer对象</param>
/// <returns>返回Url字符串</returns>
public static string getUrl(HttpRequest httpRequest,HttpServerUtility server)
{
string temp;
if (httpRequest.ServerVariables["HTTPS"] == "off")
{
temp = "http://";
}
else
{
temp = "https://";
}
temp = temp + httpRequest.ServerVariables["SERVER_NAME"];
if (httpRequest.ServerVariables["SERVER_PORT"] != "80")
{
temp = temp + ":" + httpRequest.ServerVariables["SERVER_PORT"];
}
temp = temp + httpRequest.ServerVariables["PATH_INFO"];
if (httpRequest.ServerVariables["QUERY_STRING"] != "")
{
temp = temp + "?" + httpRequest.ServerVariables["QUERY_STRING"].Trim();
}
return server.UrlEncode(temp);
}
/// 获得请求页面的完整Url
/// </summary>
/// <param name="httpRequest">httpRequest对象</param>
/// <param name="server">HttpServer对象</param>
/// <returns>返回Url字符串</returns>
public static string getUrl(HttpRequest httpRequest,HttpServerUtility server)
{
string temp;
if (httpRequest.ServerVariables["HTTPS"] == "off")
{
temp = "http://";
}
else
{
temp = "https://";
}
temp = temp + httpRequest.ServerVariables["SERVER_NAME"];
if (httpRequest.ServerVariables["SERVER_PORT"] != "80")
{
temp = temp + ":" + httpRequest.ServerVariables["SERVER_PORT"];
}
temp = temp + httpRequest.ServerVariables["PATH_INFO"];
if (httpRequest.ServerVariables["QUERY_STRING"] != "")
{
temp = temp + "?" + httpRequest.ServerVariables["QUERY_STRING"].Trim();
}
return server.UrlEncode(temp);
}