public static string BaseUrl()
{
return HttpContext.Current.Request.ApplicationPath;
}
public static string GetIP(HttpContextBase ctrl)
{
string ip;
if (ctrl.Request.ServerVariables["HTTP_VIA"] != null)
{
ip = ctrl.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else
{
ip = ctrl.Request.ServerVariables["REMOTE_ADDR"].ToString();
}
return ip;
}
找 "Map" 或者 "AbsolutePath" 之类的字眼。 ApplicationPath是指从web应用根目录算起的相对路径