小隐的博客

人生在世,笑饮一生
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

asp.net 取得URL信息

Posted on 2010-08-26 09:49  隐客  阅读(210)  评论(0编辑  收藏  举报
AbsolutePath = "/ReportManage/ReportWindow.aspx"

AbsoluteUri = "http://localhost:18725/ReportManage/ReportWindow.aspx?action=PickGoodsInfo&keyid=4ffeb15b-c269-451a-95a0-1eb22cbefd18"

Authority = "localhost:18725"

Host = "localhost"

LocalPath = "/ReportManage/ReportWindow.aspx"


OriginalString = "http://localhost:18725/ReportManage/ReportWindow.aspx?action=PickGoodsInfo&keyid=4ffeb15b-c269-451a-95a0-1eb22cbefd18"


PathAndQuery = "/ReportManage/ReportWindow.aspx?action=PickGoodsInfo&keyid=4ffeb15b-c269-451a-95a0-1eb22cbefd18"


Query = "?action=PickGoodsInfo&keyid=4ffeb15b-c269-451a-95a0-1eb22cbefd18"


Segments = {string[3]}
[0] = "/"
[1] = "ReportManage/"
[2] = "ReportWindow.aspx"

 

 

 顺便给出以下地址的方法,给到多少级,自己看着用Length-n

 http://localhost:18725/ReportManage/

 

            string[] webnet=new string[Context.Request.Url.Segments.Length-1];

            Array.Copy (Context.Request.Url.Segments,webnet ,Context.Request.Url.Segments.Length-1);

Context.Request.Url.Authority + string.Join("", webnet) 

 

 

网上90%的,不知道是不是版本的问题,都是错误的,寒一个!!

 

 

QQ交流