我可以用得到我的瀏覽器網址:string url = HttpContext.Current.Request.Url.AbsoluteUri;
但是說,如果我有如下的URL:得到任何東西在URL
http://www.test.com/MyDirectory/AnotherDir/testpage.aspx
我將如何得到它的「mydirectory中」的一部分,是有.NET中的實用工具來獲取這個或我需要字符串操作嗎?
如果我在第一個「/」的實例之後進行字符串操作並說出任何內容,那麼它不會在http:?之後返回斜槓。如果我的網址是www.test.com/MyDirectory/AnotherDir/testpage.aspx
能有人幫
你檢查類的其他屬性,例如['AbsolutePath'](http://msdn.microsoft.com/en-us/library/system.uri.absolutepath.aspx)? –