HtmlTextWriter.WriteEncodedUrl(String) HtmlTextWriter.WriteEncodedUrl(String) HtmlTextWriter.WriteEncodedUrl(String) HtmlTextWriter.WriteEncodedUrl(String) Method

定義

為指定的 URL 編碼,然後將其寫入輸出資料流。Encodes the specified URL, and then writes it to the output stream. URL 可能包含參數。The URL might include parameters.

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

參數

url
String String String String

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

範例

下列程式碼範例示範如何使用WriteEncodedUrl方法,它會產生下列輸出:The following code example shows how to use the WriteEncodedUrl method, which generates the following output:

http://localhost/Sample%20Folder/Sample%20%2b%20File.txt

// Assign a value to a string variable
// and URL-encode it to a page.
url = "http://localhost/SampleFolder/Sample + File.txt"; 
writer.WriteBreak();
writer.WriteEncodedUrl(url);
writer.WriteBreak();
' Assign a value to a string variable
' and URL-encode it to a page.
url = "http://localhost/SampleFolder/Sample + File.txt" 
writer.WriteBreak()
writer.WriteEncodedUrl(url)
writer.WriteBreak()

備註

方法會根據 URL 編碼的規格url來編碼參數中的字串。 WriteEncodedUrlThe WriteEncodedUrl method encodes the string in the url parameter in accordance with the specification for URL encoding. 在問號(?)分隔符號後面的參數不會進行編碼。The parameters that follow the question mark (?) delimiter are not encoded.

適用於

另請參閱