Url WithQuery Method (QueryData, String)C# API
Initialises a new instance of the Url class using the attributes of this Url, but with the specified QueryData object percent-encoded using the supplied list of unsafeCharacters (replacing the existing query data if present).

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: (

public Url WithQuery(
	QueryData queryData,
	string unsafeCharacters


Type: Facilita.Web QueryData
A collection of key/value pairs to be appended to the URL.
Type: System String
A list of unsafe characters that will be percent-encoded in the query data of the URL.

Return Value

A new Url object which is the same as this Url but with the specified queryData.

The queryData object will be percent-encoded using the supplied list of unsafeCharacters. See UrlEncode(String) for more information about percent-encoding.

The following example demonstrates adding a QueryData object to an existing Url, encoding the ~ character as %7E.
IpEndPoint myServer = new IpEndPoint("www.myCompany.co.uk", 8080);
Url url = new Url(Protocol.HTTP, myServer, "index.php");

QueryData queryData = new QueryData();
queryData.Add("sessionID", "~12345");

Url url2 = url.WithQuery(queryData, Coder.DefaultUnsafeCharacters + "~");
// This refers to http://www.myCompany.co.uk:8080/index.php?sessionID=12345
See Also