Beispiel #1
0
 /// <summary>
 /// Encodes a <b>URL</b> string using the specified encoding object.
 /// </summary>
 /// <param name="value">The text to encode.</param>
 /// <param name="codePage">The <see cref="System.Text.Encoding"/> object that specifies the encoding scheme. </param>
 /// <param name="encodingType">The type of the encoder.</param>
 public static string UrlEncode(string value, UrlEncodingType encodingType, Encoding codePage)
 {
     if (String.IsNullOrEmpty(value))
     {
         return(String.Empty);
     }
     if (encodingType == UrlEncodingType.PercentEncoding)
     {
         return(OAuthUtility.PercentEncode(value, codePage));
     }
     else if (encodingType == UrlEncodingType.Default)
     {
         return(HttpUtility.UrlEncode(value, codePage));
     }
     else
     {
         return(value);
     }
 }