代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Asp.Net
】
取得网站的根目录的URL,包括虚拟目录
作者:
Dezai.CN
/ 发布于
2012/3/6
/
494
取得网站的根目录的URL,包括虚拟目录
<div><font color="#808080" face="新宋体">///</font> <span xml:lang="EN-US" style="color: gray; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><summary> </span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: gray;">///</span> </span><span style="color: green; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;">取得网站的根目录的<span xml:lang="EN-US">URL,</span>包括虚拟目录</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: gray;">///</span> <span style="color: gray;"></summary></span></span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: gray;">///</span> <span style="color: gray;"><returns></span></span><span style="color: green; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;">如:<span xml:lang="EN-US">https</span>:<span xml:lang="EN-US">//www.do.com/apppath</span></span> <span xml:lang="EN-US" style="color: gray; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"></returns></span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">string</span> GetRootURI()</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> {</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">string</span> AppPath = <span style="color: rgb(163, 21, 21);">""</span>;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: rgb(43, 145, 175);">HttpContext</span> HttpCurrent = <span style="color: rgb(43, 145, 175);">HttpContext</span>.Current;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: rgb(43, 145, 175);">HttpRequest</span> Req;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">if</span> (HttpCurrent != <span style="color: blue;">null</span>)</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> {</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> Req = HttpCurrent.Request;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"> </span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">string</span> UrlAuthority = Req.Url.GetLeftPart(<span style="color: rgb(43, 145, 175);">UriPartial</span>.Authority);</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">if</span> (Req.ApplicationPath == <span style="color: blue;">null</span> || Req.ApplicationPath == <span style="color: rgb(163, 21, 21);">"/"</span>)</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: green;">//</span></span><span style="color: green; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;">直接安装在<span xml:lang="EN-US"><span style="mso-spacerun: yes;"> </span> Web<span style="mso-spacerun: yes;"> </span></span> 站点<span xml:lang="EN-US"><span style="mso-spacerun: yes;"> </span></span></span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> AppPath = UrlAuthority;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">else</span></span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: green;">//</span></span><span style="color: green; font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;">安装在虚拟子目录下</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> AppPath = UrlAuthority + Req.ApplicationPath;</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> }</span> <p align="left" style="text-align: left; mso-layout-grid-align: none;"><span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> <span style="color: blue;">return</span> AppPath;</span> <span xml:lang="EN-US" style="font-family: 新宋体; font-size: 9pt; mso-hansi-font-family: "Times new roman"; mso-font-kerning: 0pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span> }</span> </div>
试试其它关键字
同语言下
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
可能有用的
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3