ASP.NET中几种获取URL的方法


//获取完整url (协议名+域名+站点名+文件名+参数)  

string fullUrl = Request.Url.ToString();

//获取客户端请求的URL信息(不包括主机和端口)  

string rawUrl = Request.RawUrl;

//获取站点名+页面名  

string absolutePath = Request.Url.AbsolutePath;

//获取主机部分  

string urlHost = Request.Url.Host;

//获取参数部分  

string urlQuery = Request.Url.Query;

//获取服务器上ASP.NET应用程序的虚拟路径  

string ApplicationPath = Request.ApplicationPath;

//获取当前请求的虚拟路径  

string CurrentExecutionFilePath = Request.CurrentExecutionFilePath;

//获取当前请求的虚拟路径  

string Path = Request.Path;

//获取具有URL扩展名的资源的附加路径信息

string PathInfo = Request.PathInfo;

//获取与请求的URL相对应的物理文件系统路径

string PhysicalPath = Request.PhysicalPath;

//获取文件名的本地操作系统表示形式  

string LocalPath = Request.Url.LocalPath;

//获取绝对URL

string AbsoluteUri = Request.Url.AbsoluteUri;

相关阅读 >>

asp.net实现URL映射的方法

asp.net中几种获取URL的方法

c#中enum与string的相互转换的示例

c# 返回对象obj的string值,obj为null时返回空值

.net框架-string是value还是reference type的详解

简述c#中builder和buffer类的用法详解

详细介绍c# string格式的日期时间字符串转为datetime类型的方法

详细介绍data URL生成工具c#版第二版的示例代码

c# 中不区分大小写的 contains(string)

c#中string类型与json之间相互转换的实现方法

更多相关阅读请进入《URL》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...