ASP.NET2.0, 網頁設計

[.NET]Request.URL取得網址中的參數

梅干2008/12/20
  以前常用Request.Pash去讀取網址後的參數,但每次要用時上網都找的半死,甘脆把它分享出來,一邊幫自已作筆記外,另一方面也給有需要的朋友們,梅干桑個人覺得還蠻不錯用的。

網址:http://localhost/minwt/doc/detail.aspx/123?id=1#top
語 法結 果
Request.ApplicationPath/
Request.PhysicalPathD:\Projects\Solution\web\minwt\doc\detail.aspx
System.IO.Path.GetDirectoryName
(Request.PhysicalPath)
D:\Projects\Solution\web\minwt\doc
Request.PhysicalApplicationPathD:\Projects\Solution\web\
System.IO.Path.GetFileName
(Request.PhysicalPath)
detail.aspx
Request.CurrentExecutionFilePath/minwt/doc/detail.aspx
Request.FilePath/minwt/doc/detail.aspx
Request.Path/minwt/doc/detail.aspx/123
Request.RawUrl/minwt/doc/detail.aspx/123?id=1
Request.Url.AbsolutePath/minwt/doc/detail.aspx/123
Request.Url.AbsoluteUrihttp://localhost/minwt/doc/detail.aspx/123?id=1
Request.Url.Schemehttp
Request.Url.Hostlocalhost
Request.Url.Port1897
Request.Url.Authoritylocalhost:1897
Request.Url.LocalPath/minwt/doc/detail.aspx/123
Request.PathInfo/123
Request.Url.PathAndQuery/minwt/doc/detail.aspx/123?id=1
Request.Url.Query?id=1
Request.Url.Segments/
minwt/
doc/
detail.aspx/
123

UAG軍規iPhone防摔殼