asp.net擷取URL方法

來源:互聯網
上載者:User

標籤:oca   網站   raw   form   ble   style   logs   相對   伺服器   

方法如下:

Request.Url.ToString()擷取完整url(協議名+網域名稱+網站名+檔案名稱+參數):https://localhost:44300/WebForm1.aspx?abc=123Request.RawUrl擷取用戶端請求的URL資訊(不包括主機和連接埠):/WebForm1.aspx?abc=123Request.Url.AbsolutePath擷取網站名+頁面名:/WebForm1.aspxRequest.Url.Host擷取主機部分:localhostRequest.Url.Query擷取參數部分:?abc=123Request.ApplicationPath擷取應用程式的虛擬應用程式根路徑:/Request.CurrentExecutionFilePath擷取當前請求的虛擬路徑:/WebForm1.aspxRequest.Path擷取當前請求的虛擬路徑:/WebForm1.aspxRequest.PathInfo擷取具有URL副檔名的資源的附加路徑資訊:Request.PhysicalPath擷取與請求的URL相對應的物理檔案系統路徑:c:\users\jim\documents\visual studio 2010\Projects\WebApplication3\WebApplication3\WebForm1.aspxRequest.Url.LocalPath擷取檔案名稱的本地作業系統表示形式:/WebForm1.aspxRequest.Url.AbsoluteUri擷取絕對URL:https://localhost:44300/WebForm1.aspx?abc=123Request.ServerVariables.Get("Local_Addr")擷取伺服器IP:::1Request.Url.Port擷取伺服器連接埠:44300Request.Url.Scheme擷取伺服器協議頭:https

 

asp.net擷取URL方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.