2016年10月17日 星期一

[C#] 取得網址 Using Request.Url to find specific parts of the web page's URL



參考:http://www.codepal.co.uk/show/Using_RequestUrl_to_find_specific_parts_of_the_web_pages_address




Request.Url.GetLeftPart(UriPartial.Authority) http://www.codepal.co.uk:123
Request.Url.GetLeftPart(UriPartial.Path) http://www.codepal.co.uk:123/RequestUri.aspx
Request.Url.GetLeftPart(UriPartial.Query) http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.GetLeftPart(UriPartial.Scheme) http://
Request.Url.ToString http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.AbsolutePath /RequestUri.aspx
Request.Url.AbsoluteUri http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.Authority www.codepal.co.uk:123
Request.Url.GetComponents(UriComponents.AbsoluteUri, UriFormat.SafeUnescaped) http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.GetComponents(UriComponents.Fragment, UriFormat.SafeUnescaped)
Request.Url.GetComponents(UriComponents.Host, UriFormat.SafeUnescaped) www.codepal.co.uk
Request.Url.GetComponents(UriComponents.HostAndPort, UriFormat.SafeUnescaped) www.codepal.co.uk:123
Request.Url.GetComponents(UriComponents.HttpRequestUrl, UriFormat.SafeUnescaped) http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.GetComponents(UriComponents.KeepDelimiter, UriFormat.SafeUnescaped)
Request.Url.GetComponents(UriComponents.Path, UriFormat.SafeUnescaped) RequestUri.aspx
Request.Url.GetComponents(UriComponents.PathAndQuery, UriFormat.SafeUnescaped) /RequestUri.aspx?queryStringVal=Hello
Request.Url.GetComponents(UriComponents.Port, UriFormat.SafeUnescaped) 123
Request.Url.GetComponents(UriComponents.Query, UriFormat.SafeUnescaped) queryStringVal=Hello
Request.Url.GetComponents(UriComponents.Scheme, UriFormat.SafeUnescaped) http
Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped) http://www.codepal.co.uk:123
Request.Url.GetComponents(UriComponents.SerializationInfoString, UriFormat.SafeUnescaped) http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
Request.Url.GetComponents(UriComponents.StrongAuthority, UriFormat.SafeUnescaped) www.codepal.co.uk:123
Request.Url.GetComponents(UriComponents.StrongPort, UriFormat.SafeUnescaped) 123
Request.Url.Host www.codepal.co.uk
Request.Url.HostNameType.ToString Dns
Request.Url.OriginalString http://www.codepal.co.uk:123/RequestUri.aspx?queryStringVal=Hello
 

MangoHost Copyright © 2009 Cookiez is Designed by Ipietoon for Free Blogger Template