HtmlTextWriter.WriteEncodedUrlParameter(String) HtmlTextWriter.WriteEncodedUrlParameter(String) HtmlTextWriter.WriteEncodedUrlParameter(String) HtmlTextWriter.WriteEncodedUrlParameter(String) Method

定義

針對要求裝置為指定的 URL 參數編碼,然後將此 URL 寫入輸出資料流中。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)

參數

urlText
String String String String

要編碼及寫入輸出資料流中的 URL 參數字串。The URL parameter string to encode and write to the output stream.

範例

下列程式碼範例示範如何使用WriteEncodedUrlParameter方法,它會產生下列輸出: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)

備註

URL 的參數部分中的空格會編碼為加號(+),而等號(=)會編碼為%3dSpaces in the parameter part of a URL are encoded as plus signs (+), and equal signs (=) are encoded as %3d.

適用於

另請參閱