asp.net 获取网站根地址
public static string GetSiteRoot()
{
string port = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
if (port == null || port == "" || port == "")
{
port = "";
}
else
{
port = ":" + port;
}
string protocol = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_PORT_SECURE"];
if (protocol == null || protocol == "")
{
protocol = "http://";
}
else
{
protocol = "https://";
}
string sOut = protocol + System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + port + System.Web.HttpContext.Current.Request.ApplicationPath;
if (sOut.EndsWith("/"))
{
sOut = sOut.Substring(, sOut.Length - );
}
return sOut;
}
asp.net 获取网站根地址的更多相关文章
- ASP php获取文件URL地址等方法
$_SERVER["HTTP_REFERER"] rss中可用 echo next(explode("=", $_SERVER["QUERY_STRI ...
- asp.net 获取网站根目录总结 Global.asax文件里获取获取网站根目录
1: 获取网站根目录的方法有几种如: Server.MapPath(Request.ServerVariables["PATH_INFO"])Server.MapPath(&qu ...
- ASP.NET获取网站根目录(路径)
摘自: http://blog.sina.com.cn/s/blog_7d0dcba60100vb7r.html 网站在服务器磁盘上的物理路径: HttpRuntime.AppDomainAppPat ...
- asp.net 获取当前url地址
设当前页完整地址是:http://www.jb51.net/aaa/bbb.aspx?id=5&name=kelli "http://"是协议名 "www.jb5 ...
- Asp.net获取网站绝对路径的几种方法
在编写ASP.NET应用程序的时候,有时候为了更好的进行控制静态文件的路径,以及网站部署过程中的虚拟路径等问题,采用绝对路径避免资源出现Not Found,下面先看看几种获取绝对路径的方法: 1. 以 ...
- asp.net 获取网站根目录总结
.CSHttpContext.Current.Server.MapPath();//所在文件夹路径System.Web.HttpContext.Current.Request.PhysicalAppl ...
- asp.net获取访问者ip地址的函数
/// <summary> /// 获取IP地址 /// </summary> public static string IPAddress { get { string us ...
- ASP.NET 获取客户端IP地址
我们用Request.ServerVariables( "REMOTE_ADDR ") 来取得客户端的IP地址, 但如果客户端是使用代理服务器来访问,那取到的就是代理服务器的I ...
- php实例-正则获取网站音频地址的实例(Listen to this 1)
主要用到了:file_get_contents();preg_match_all(); 这2个函数 查看地址:http://git.oschina.net/xiaoz6/phpExample
随机推荐
- 使用GetAdaptersInfo时,网卡类型的值为71
使用GetAdaptersInfo时,网卡类型的值为71,代表无线网卡.
- C#语言不常用语法笔记
只看过3天C#语法书,了解个大概,与C++等不同之处,或者看开源遇到一些奇异用法,记录一下,脑子不够用的情况下,还是记笔记靠谱. ==================== 顺便吐槽下,这年头得会各种编 ...
- Shell脚本学习-数组
跟着RUNOOB网站的教程学习的笔记 Shell数组 数组中可以存放多个值,Bash Shell只支持一维数组(不支持多维数组),初始化时不需要定义数组大小(与PHP类似). 与大部分编程语言类似,数 ...
- 读取嵌入到word的Excel对象
Word.Document doc = this._wordApplication.Documents.Add(@"C:\Users\linmeicheng\Desktop\新建文件夹 (3 ...
- python3字符串操作
python3字符串操作 x = 'abc' y = 'defgh' print(x + y) #x+y print(x * ) #x*n print(x[]) #x[i] print(y[:-]) ...
- 设置UniDbGrid的整行显示颜色,如果某字段值是我们的控制字段
设置UniDbGrid的整行显示颜色,如果某字段值是我们的控制字段,使用下列判断设置更快捷一点: procedure TUniForm.UniDBGridDrawColumnCell(Sender: ...
- Mapreduce atop Apache Phoenix (ScanPlan 初探)
利用Mapreduce/hive查询Phoenix数据时如何划分partition? PhoenixInputFormat的源码一看便知: public List<InputSplit> ...
- 761. Special Binary String
Special binary strings are binary strings with the following two properties: The number of 0's is eq ...
- postgres Date/Time 学习笔记
一.Date/Time Types 参考文档:https://www.postgresql.org/docs/9.2/static/datatype-datetime.html Types 别名 ti ...
- Ubuntu 16.04 python和OpenCV安装
Ubuntu 16.04 python和OpenCV安装:最进在做深度学习和计算机视觉的有关内容,因此要在python中用到opencv.我的电脑装的是Ubuntu 16.04,python 2.7和 ...