Show / Hide Table of Contents

    Class HttpUtility

    This utility class is a light-weight implementation of the now deprecated HttpUtility class. Was made for backward compatibility in terms of UrlEncode(String, Encoding) and UrlDecode(String, Encoding).

    Inheritance
    System.Object
    HttpUtility
    Namespace: Cuemon.Web
    Assembly: Cuemon.Web.dll
    Syntax
    public static class HttpUtility
    Remarks

    Kudos to the mono-project team for this class. I only modified some of the original code to fit into this class. For the original code, have a visit here for the source code: https://github.com/mono/mono/blob/master/mcs/class/System.Web/System.Web/HttpUtility.cs or here for the mono-project website: http://www.mono-project.com/.

    Methods

    | Improve this Doc

    UrlDecode(String)

    Converts a string that has been encoded for transmission in a URL into a decoded string.

    Declaration
    public static string UrlDecode(string str)
    Parameters
    Type Name Description
    System.String str

    The string to decode.

    Returns
    Type Description
    System.String

    A decoded string.

    | Improve this Doc

    UrlDecode(String, Encoding)

    Converts a URL-encoded string into a decoded string, using the specified encoding object.

    Declaration
    public static string UrlDecode(string str, Encoding e)
    Parameters
    Type Name Description
    System.String str

    The string to decode.

    System.Text.Encoding e

    The System.Text.Encoding that specifies the decoding scheme.

    Returns
    Type Description
    System.String

    A decoded string.

    | Improve this Doc

    UrlEncode(String)

    Converts a string into a URL-encoded array of bytes using the specified encoding object.

    Declaration
    public static string UrlEncode(string str)
    Parameters
    Type Name Description
    System.String str

    The string to encode.

    Returns
    Type Description
    System.String

    An encoded array of bytes.

    | Improve this Doc

    UrlEncode(String, Encoding)

    Converts a string into a URL-encoded array of bytes using the specified encoding object.

    Declaration
    public static string UrlEncode(string str, Encoding e)
    Parameters
    Type Name Description
    System.String str

    The string to encode.

    System.Text.Encoding e

    The System.Text.Encoding that specifies the encoding scheme.

    Returns
    Type Description
    System.String

    An encoded array of bytes.

    | Improve this Doc

    UrlEncodeToBytes(Byte[], Int32, Int32)

    Converts an array of bytes into a URL-encoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

    Declaration
    public static byte[] UrlEncodeToBytes(byte[] bytes, int offset, int count)
    Parameters
    Type Name Description
    System.Byte[] bytes

    The array of bytes to encode.

    System.Int32 offset

    The position in the byte array at which to begin encoding.

    System.Int32 count

    The number of bytes to encode.

    Returns
    Type Description
    System.Byte[]

    An encoded array of bytes.

    | Improve this Doc

    UrlEncodeToBytes(Byte[], Int32, Int32, Boolean, Encoding)

    Converts an array of bytes into a URL-encoded array of bytes, starting at the specified position in the array and continuing for the specified number of bytes.

    Declaration
    public static byte[] UrlEncodeToBytes(byte[] bytes, int offset, int count, bool preferUppercaseHexadecimalEncoding, Encoding encoding = null)
    Parameters
    Type Name Description
    System.Byte[] bytes

    The array of bytes to encode.

    System.Int32 offset

    The position in the byte array at which to begin encoding.

    System.Int32 count

    The number of bytes to encode.

    System.Boolean preferUppercaseHexadecimalEncoding

    When true, the bytes is encoded using upper-case hexadecimal characters; otherwise lower-case hexadecimal characters.

    System.Text.Encoding encoding

    The text encoding to use when writing the encoded bytes. The default is System.Text.UTF8Encoding.

    Returns
    Type Description
    System.Byte[]

    An encoded array of bytes.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX