CSharp examples for System.Net:IP Address
Uri To Https
using System.Text; using System;/*w w w .j a va 2s .c o m*/ public class Main{ public static Uri ToHttps(this Uri uri) { if (uri.Scheme == "https") return uri; var sb = new StringBuilder(); sb.Append("https://"); sb.Append(uri.DnsSafeHost); if(uri.Port != 80) { sb.Append(":"); sb.Append(uri.Port); } sb.Append(uri.PathAndQuery); return new Uri(sb.ToString()); } }