Partager via


Sys.Net.WebRequest.getResolvedUrl Method

Gets the resolved URL of the Sys.Net.WebRequest instance.

var requestUrl = MyWebRequest.getResolvedUrl();

Parameters

Parameter

Description

value

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

Exceptions

Exception type

Condition

Sys.ArgumentNullException

value is null.

Return Value

The resolved URL that the Web request is directed to.

Remarks

This method returns the absolute URL representation, of the URL associated with the WebRequest instance. The URL includes the protocol identifier and the fully qualified domain name. This method is used by other classes such as network executors to determine the target URL for a Web request.

Example

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

// This function gets the resolved Url 
// of the Web request instance.
function GetWebRequestResolvedUrl()
{    
    // Instantiate the WebRequest.
    var wRequest =  new Sys.Net.WebRequest();

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

    // Get the web request completed event handler.
    var resUrl = wRequest.getResolvedUrl();   
    alert("Resolved Url: " + resUrl);

    // Set the web request completed event handler,
    // for processing return data.
    wRequest.add_completed(OnWebRequestCompleted); 

    // Execute the request.
    wRequest.invoke();  
}

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class