HtmlTextWriter.WriteEncodedUrlParameter Method (String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public virtual void WriteEncodedUrlParameter(
	string urlText
)

Parameters

urlText
Type: System.String

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

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

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

ID%3dCity+State

// 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);

.NET Framework
Available since 2.0
Return to top
Show: