1. <td id="dzoci"></td>
          <style id="dzoci"></style>
      2. 濟(jì)寧果殼科技專業(yè)軟件開發(fā)團(tuán)隊(duì),提供全方位的互聯(lián)網(wǎng)服務(wù)!
        座機(jī):15563775221 手機(jī):15563775221(微信)

        熱門標(biāo)簽

        1. 首頁(yè)
        2. 果殼學(xué)院
        3. 技術(shù)顧問(wèn)
        4. 使用asp.net 獲取當(dāng)前網(wǎng)址/url/域名 怎么處理呢?
        使用asp.net  獲取當(dāng)前網(wǎng)址/url/域名  怎么處理呢?

        使用asp.net 獲取當(dāng)前網(wǎng)址/url/域名 怎么處理呢?

        獲取當(dāng)前網(wǎng)址/url/域名

        濟(jì)寧果殼科技

        2017-06-06 18:46:25

        15

        5245


        使用asp.net  獲取當(dāng)前網(wǎng)址/url/域名  怎么處理呢?


        設(shè)當(dāng)前頁(yè)完整地址是:http://www.highschoolsportsmn.com/college/117.html

        "http://"是協(xié)議名

        "www.highschoolsportsmn.com"是域名

        "college"是站點(diǎn)目錄名

        "117.html"是頁(yè)面名(文件名)

        【1】獲取 完整url (協(xié)議名+域名+站點(diǎn)名+文件名+參數(shù))

        代碼如下:


        string url=Request.Url.ToString();

        url  值為  http://www.highschoolsportsmn.com/college/117.html



        【2】獲取 站點(diǎn)名+頁(yè)面名+參數(shù):

        代碼如下:


        string url=Request.RawUrl;

        (或 string url=Request.Url.PathAndQuery;)

        url 值為 /college/117.html



        【3】獲取 站點(diǎn)名+頁(yè)面名:

        代碼如下:


        string url=HttpContext.Current.Request.Url.AbsolutePath;

        (或 string url= HttpContext.Current.Request.Path;)

        url  值為 college/117.html



        【4】獲取 域名:

        代碼如下:


        string url=HttpContext.Current.Request.Url.Host;

        url  值為 www.highschoolsportsmn.com/college



        【5】獲取 參數(shù):

        代碼如下:


        string url= HttpContext.Current.Request.Url.Query;

        url  類似于  ?id=5




        代碼如下:


        Request.RawUrl:獲取客戶端請(qǐng)求的URL信息(不包括主機(jī)和端口)------>/117.html

        Request.ApplicationPath:獲取服務(wù)器上ASP.NET應(yīng)用程序的虛擬路徑。------>/

        Request.CurrentExecutionFilePath:獲取當(dāng)前請(qǐng)求的虛擬路徑。------>/117.html

        Request.Path:獲取當(dāng)前請(qǐng)求的虛擬路徑。------>/117.html

        Request.PathInfo:取具有URL擴(kuò)展名的資源的附加路徑信息------>

        Request.PhysicalPath:獲取與請(qǐng)求的URL相對(duì)應(yīng)的物理文件系統(tǒng)路徑。------>E:\temp\117.html

        Request.Url.LocalPath:------>/117.html

        Request.Url.AbsoluteUri:------>http://localhost:8080/117.html

        Request.Url.AbsolutePath:---------------------------->/117.html


        定制首選 果殼科技 咨詢熱線:0537-2551991

        關(guān)閉咨詢框
        国产交换配偶在线视频,豆国产97在线 | 亚洲,亚洲国产第一福利一区二区,在线视频免费国产午夜 国产在线不卡每日更新福利 国产无码一二三专区

            1. <td id="dzoci"></td>
                <style id="dzoci"></style>