Share via


HelperPage.Href Method

Builds an absolute URL from an application-relative URL by using the specified parameters.

Namespace:  System.Web.WebPages
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

Syntax

'Declaration
Public Shared Function Href ( _
    path As String, _
    ParamArray pathParts As Object() _
) As String
'Usage
Dim path As String 
Dim pathParts As Object()
Dim returnValue As String 

returnValue = HelperPage.Href(path, pathParts)
public static string Href(
    string path,
    params Object[] pathParts
)
public:
static String^ Href(
    String^ path, 
    ... array<Object^>^ pathParts
)
static member Href : 
        path:string * 
        pathParts:Object[] -> string
public static function Href(
    path : String, 
    ... pathParts : Object[]
) : String

Parameters

  • pathParts
    Type: System.Object[]
    Additional path information, such as folders and subfolders.

Return Value

Type: System.String
The absolute URL.

Remarks

The Href(String, Object[]) method combines the initial path (such as the application root that is provided in the path parameter) with a list of folders, subfolders, and file names that are provided in the pathParts parameter. It returns a fully-qualified URL. For example, if path parameter contains the string "~/Music" and the pathParts array contains the strings "Jazz" and "Saxophone.wav", the Href(String, Object[]) method returns the URL https://localhost/MyApp/Music/Jazz/Saxophone.wav.

See Also

Reference

HelperPage Class

System.Web.WebPages Namespace