แก้ไข

แชร์ผ่าน


HtmlTextWriter.WriteEncodedUrlParameter(String) Method

Definition

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

public:
 virtual void WriteEncodedUrlParameter(System::String ^ urlText);
public virtual void WriteEncodedUrlParameter (string urlText);
abstract member WriteEncodedUrlParameter : string -> unit
override this.WriteEncodedUrlParameter : string -> unit
Public Overridable Sub WriteEncodedUrlParameter (urlText As String)

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

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

See also