Advertisement
Guest User

Untitled

a guest
Jun 6th, 2013
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. http://127.0.0.1:96/Cambia3
  2.  
  3. http://127.0.0.1/Cambia3
  4.  
  5. var ip= new Uri("http://127.0.0.1:96/Cambia3");
  6. var withoutPort = string.Format("{0}://{1}/{2}", ip.Scheme, ip.Host, ip.PathAndQuery);
  7.  
  8. var builder=new UriBuilder("http://127.0.0.1:96/Cambia3");
  9. builder.Port = 80;
  10. Console.WriteLine(builder.Uri.AbsoluteUri);
  11.  
  12. string str = "http://127.0.0.1:96/Cambia3";
  13. int index1 = str.IndexOf(':', 7);
  14. int index2 = str.IndexOf('/', 7);
  15.  
  16. str.Remove(index1, index2 - index1);
  17.  
  18. UriBuilder uri = new UriBuilder("http://127.0.0.1:96/Cambia3");
  19. uri.Port =-1;
  20. string portlessurl = uri.Uri.AbsoluteUri; // Output -- http://127.0.0.1/Cambia3
  21.  
  22. string ip = "http://127.0.0.1:96/Cambia3";
  23. ip = ip.Replace(":96", string.Empty);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement