Use of Uri class in asp.net 2.0.
=======================
//namespaceusing System.Net;
private void showUrlParts()
{
Uri sample = new Uri("http://yourpath/bass_aei/login.aspx?param=22");
Response.Write("Host: " + sample.Host + "<br/>");
Response.Write("Port: " + sample.Port + "<br/>");
Response.Write("Scheme: " + sample.Scheme + "<br/>");
Response.Write("Local Path: " + sample.LocalPath + "<br/>");
Response.Write("Query: " + sample.Query + "<br/>");
Response.Write("Path and query: " + sample.PathAndQuery + "<br/>");
}
//Host: localhost
//Port: 80
//Scheme: http
//Local Path: /yourpath/login.aspx
//Query: ?param=22
//Path and query: /yourpath/login.aspx?param=22
No comments:
Post a Comment