Saturday , 27 April 2024
HOT

Request URL trong asp.net

Giả sử bạn có link web của bạn có dạng sau đây http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue
Bạn muốn lấy một phần của link thôi, nhưng trong Request.Url có quá nhiều thuộc tính, ví dụ sau đây sẽ cho biết kết quả trả về của các thuộc tính.

Request.ApplicationPath : /virtual_dir
Request.CurrentExecutionFilePath : /virtual_dir/myrep/page.aspx
Request.FilePath : /virtual_dir/myrep/page.aspx
Request.Path : /virtual_dir/myrep/page.aspx
Request.PhysicalApplicationPath : d:\Inetpub\wwwroot\Websitename\virtual_dir\
Request.QueryString : /virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.AbsolutePath : /virtual_dir/myrep/page.aspx
Request.Url.AbsoluteUri : http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.Host : localhost
Request.Url.Authority : localhost:2000
Request.Url.LocalPath : /virtual_dir/myrep/page.aspx
Request.Url.PathAndQuery : /virtual_dir/myrep/page.aspx?q=qvalue
Request.Url.Port : 2000
Request.Url.Query : ?q=qvalue
Request.Url.Scheme : http
Request.Url.Segments : /
  virtual_dir/
  myrep/
  page.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *

*