Partager via


Sys.Net.WebRequest url Property

Gets or sets the URL of the Sys.Net.WebRequest instance.

var requestUrl = MyWebRequest.get_url();
MyWebRequest.set_url(value);

Parameters

Parameter

Description

value

A string that represents the URL that the Web request is directed to.

Exceptions

Exception type

Condition

Sys.ArgumentNullException

value cannot be null.

Return Value

The URL that the Web request is directed to. If the URL has not been previously set, returns an empty string ("").

Remarks

You can set the URL to a fully qualified URL, an absolute URL, or a relative URL. The WebRequest class makes sure that the value that you set is converted into a form that the network executor can use.

Example

The following example shows how to set the URL for a WebRequest instance. This code is part of a complete example found in the WebRequest class overview.

// Set the request Url.  
wRequest.set_url(postPage); 

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class