Wednesday, March 13, 2013

Using URI Class

using System.Net;
...
Uri uri = new Uri(txtURI.Text);
txtURI.AppendText("Absolute URI: " + uri.AbsoluteUri + "\r\n");
txtURI.AppendText("Absolute Path: " + uri.AbsolutePath + "\r\n");
txtURI.AppendText("Local path: " + uri.LocalPath + "\r\n");
txtURI.AppendText("Scheme: " + uri.Scheme + "\r\n");
txtURI.AppendText("Authority: " + uri.Authority + "\r\n");
txtURI.AppendText("Host: " + uri.Host + "\r\n");
txtURI.AppendText("Port: " + uri.Port + "\r\n");
txtURI.AppendText("Fragment: " + uri.Fragment + "\r\n");
txtURI.AppendText("Query: " + uri.Query + "\r\n");
//Get absolute URI from a base and relative URI
Uri uriBase = new Uri(“https://sites.google.com/site/BarqKadapavi”);
Uri absoluteUri = new Uri(uriBase, “Images/MyImages.htm”);
txtAbsolute.Text = absoluteUri.ToString();

No comments:

Post a Comment