摘要:[ASP.NET][轉貼]Request擷取網址的方法
假設我們的網址為http://demo.tc/Default3.aspx?id=1019&uu=77
Request.ApplicationPath
//output:/
Request.PhysicalPath
//output:磁碟機代號:\父目錄\子目錄\Default3.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)
//output:磁碟機代號:\父目錄\子目錄
Request.PhysicalApplicationPath
//output:磁碟機代號:\父目錄\子目錄\
System.IO.Path.GetFileName(Request.PhysicalPath)
//output:Default3.aspx
Request.CurrentExecutionFilePath
//output:/Default3.aspx
Request.FilePath
//output:/Default3.aspx
Request.Path
//output:/Default3.aspx
Request.RawUrl
//output:/Default3.aspx?id=1019&uu=77
Request.Url.AbsolutePath
//output:/Default3.aspx
Request.Url.AbsoluteUri
//output:http://demo.tc/Default3.aspx?id=1019(這是上一頁的網址)
Request.Url.Scheme
//output:http
Request.Url.Host
//output:demo.tc
Request.Url.Port
//output:80
Request.Url.Authority
//output:demo.tc
Request.Url.LocalPath
//output:/Default3.aspx
Request.PathInfo
//output:
Request.Url.PathAndQuery
//output:/Default3.aspx?id=1019&uu=77
Request.Url.Query
//output:?id=1019&uu=77
Request.Url.Query[id]
//output:1019
Request.Url.Query[uu]
//output:77
Request.Url.Fragment
//output:
Request.Url.Segments[0]
//output:/
Request.Url.Segments[1]
//output:Default3.aspx
轉自http://demo.tc/Post/230