国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

Asp.net中Request.Url的各個屬性對應的意義介紹

2024-07-10 12:41:26
字體:
來源:轉載
供稿:網友
1.簡單的環境搭建
  在本地IIS上配置了一個網站:主機名為wjnhome.com,端口88,然后建了一個虛擬目錄指向同一站點,虛擬目錄名稱為virtual,配置host為127.0.0.1  wjnhome.com
  所以地址就為:http://Vevb.com:88/virtual/urldemo.aspx?id=2#top
2.編寫簡單的代碼
代碼如下:
//虛擬目錄的路徑
Response.Write("<strong>Request.ApplicationPath:</strong>" + Request.ApplicationPath + "</br>");
//站點的物理路徑(完整路徑)
Response.Write("<strong>Request.PhysicalPath:</strong>" + Request.PhysicalPath + "</br>");
//站點物理路徑的目錄
Response.Write("<strong>DirectoryName:</strong>" + System.IO.Path.GetDirectoryName(Request.PhysicalPath) + "</br>");
//站點物理路徑的目錄
Response.Write("<strong>Request.PhysicalApplicationPath:</strong>" + Request.PhysicalApplicationPath + "</br>");
//當前頁面的文件名
Response.Write("<strong>FileName:</strong>" + System.IO.Path.GetFileName(Request.PhysicalPath) + "</br>");
//當前頁面的虛擬路徑
Response.Write("<strong>Request.CurrentExecutionFilePath:</strong>" + Request.CurrentExecutionFilePath + "</br>");
//當前頁面的虛擬路徑
Response.Write("<strong>Request.FilePath:</strong>" + Request.FilePath + "</br>");
Response.Write("<strong>Request.Path:</strong>" + Request.Path + "</br>");
//原始URL
Response.Write("<strong>Request.RawUrl:</strong>" + Request.RawUrl + "</br>");
//絕對路徑(不包括參數什么的)
Response.Write("<strong>Request.Url.AbsolutePath:</strong>" + Request.Url.AbsolutePath + "</br>");
//絕對URL
Response.Write("<strong>Request.Url.AbsoluteUri:</strong>" + Request.Url.AbsoluteUri + "</br>");
//URL協議方案
Response.Write("<strong>Request.Url.Scheme:</strong>" + Request.Url.Scheme + "</br>");
//URL的主機名
Response.Write("<strong>Request.Url.Host:</strong>" + Request.Url.Host + "</br>");
//URL端口號
Response.Write("<strong>Request.Url.Port:</strong>" + Request.Url.Port + "</br>");
//主機名+端口號
Response.Write("<strong>Request.Url.Authority:</strong>" + Request.Url.Authority + "</br>");
//獲取文件名的本地操作系統表現形式
Response.Write("<strong>Request.Url.LocalPath:</strong>" + Request.Url.LocalPath + "</br>");
//附加路徑信息,例如http://Vevb.com:88/UrlDemo.aspx/Hello?id=22#top 那么這里就是Hello
Response.Write("<strong>Request.PathInfo:</strong>" + Request.PathInfo + "</br>");
//URL的路徑和GET參數
Response.Write("<strong>Request.Url.PathAndQuery:</strong>" + Request.Url.PathAndQuery + "</br>");
//URL的GET參數
Response.Write("<strong>Request.Url.Query:</strong>" + Request.Url.Query + "</br>");
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新余市| 苍梧县| 惠来县| 许昌县| 河南省| 留坝县| 西贡区| 沁阳市| 和龙市| 南康市| 运城市| 奉贤区| 临海市| 东方市| 溆浦县| 册亨县| 曲靖市| 长海县| 漾濞| 绥德县| 鄂托克前旗| 临沭县| 云梦县| 工布江达县| 宜良县| 沙田区| 乌苏市| 北宁市| 永济市| 油尖旺区| 香河县| 如皋市| 乌审旗| 宣恩县| 平塘县| 建德市| 武陟县| 宜春市| 凤冈县| 大英县| 青河县|