C# Class LtiLibrary.Core.Common.UrlEncodingParser

A query string or UrlEncoded form parser and editor class that allows reading and writing of urlencoded key value pairs used for query string and HTTP form data. Useful for parsing and editing querystrings inside of non-Web code that doesn't have easy access to the HttpUtility class.
Supports multiple values per key From Rick Strahl, http://weblog.west-wind.com/posts/2014/Sep/08/A-NET-QueryString-and-Form-Data-Parser
Inheritance: System.Collections.Specialized.NameValueCollection
ファイルを表示 Open project: andyfmiller/LtiLibrary Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
Parse ( string query ) : NameValueCollection

Parses the query string into the internal dictionary and optionally also returns this dictionary

SetValues ( string key, IEnumerable values ) : void

Assigns multiple values to the same key

ToString ( ) : string

Writes out the urlencoded data/query string or full URL based on the internally set values.

UrlEncodingParser ( string queryStringOrUrl = null ) : System

Always pass in a UrlEncoded data or a URL to parse from unless you are creating a new one from scratch.

Method Details

Parse() public method

Parses the query string into the internal dictionary and optionally also returns this dictionary
public Parse ( string query ) : NameValueCollection
query string /// Query string key value pairs or a full URL. If URL is /// passed the URL is re-written in Write operation ///
return System.Collections.Specialized.NameValueCollection

SetValues() public method

Assigns multiple values to the same key
public SetValues ( string key, IEnumerable values ) : void
key string
values IEnumerable
return void

ToString() public method

Writes out the urlencoded data/query string or full URL based on the internally set values.
public ToString ( ) : string
return string

UrlEncodingParser() public method

Always pass in a UrlEncoded data or a URL to parse from unless you are creating a new one from scratch.
public UrlEncodingParser ( string queryStringOrUrl = null ) : System
queryStringOrUrl string /// Pass a query string or raw Form data, or a full URL. /// If a URL is parsed the part prior to the ? is stripped /// but saved. Then when you write the original URL is /// re-written with the new query string. ///
return System