HtmlTextWriter.WriteEncodedUrlParameter(String) Method

Definition

Encodes the specified URL parameter for the requesting device, and then writes it to the output stream.

C#
public virtual void WriteEncodedUrlParameter(string urlText);

Parameters

urlText
String

The URL parameter string to encode and write to the output stream.

Examples

The following code example shows how to use the WriteEncodedUrlParameter method, which generates the following output:

ID%3dCity+State

C#
// Assign a value to a string variable
// and encode it to a page as a 
// URL parameter.      
param = "ID=City State";
writer.WriteBreak();
writer.WriteEncodedUrlParameter(param);

Remarks

Spaces in the parameter part of a URL are encoded as plus signs (+), and equal signs (=) are encoded as %3d.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also