AuthManager.GetURL
Use this method to generate an encoded Uniform Resource Locator (URL) string.
Definition
Function GetURL(FileName As String,fCookie As Boolean,fSecure As Boolean,Optional pVarURLParameters As Variant,Optional pVarURLValues As Variant) As String
Parameters
FileName
[in] A String that contains the file name to reference in the URL.
fCookie
[in] A Boolean that indicates whether the user allows cookies.
fSecure
[in] A Boolean that indicates whether the URL is secure (HTTPS versus HTTP).
pVarURLParameters
[in, optional] A SafeArray that contains a list of parameter names to include in the URL.
pVarURLValues
[in, optional] A SafeArray that contains values that correspond to the parameter names.
Return Values
If this method completes successfully, it returns a String that contains the encoded URL.
Error Values
This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
The following table shows the custom COM errors that this method can return.
Constant | Value | Description |
E_UPM_AUTHMANAGER_API_ASP_ONLY | &HC1004C24 | This method should only be called within an ASP page. |
MSG_UPM_AUTH_SITE_NEEDED_ERROR | &HC1004C10 | The Initialize method must be called with the installed site name before calling this method. |
Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.
Remarks
The encoded URL includes the host name (retrieved from the site configuration), the virtual directory in which the file is stored (determined by the scripting context), the name of the file, flags for cookie support and security, and optional custom name/value pairs (for example, the name "SKU" and the stock-keeping unit (SKU) value for an item in a shopping cart).
If cookies are not allowed, the cookie flag is set to False and the ticket is appended to the URL.
Note
- When a cached HTML segment that contains a URL with an appended ticket is retrieved, the ticket needs to be replaced with the correct one (for the current user context).
The secure flag is set to True if the referenced host is secure.
Use the URLArgs or URLShopperArgs methods to encode a URL query string out of name/value pairs.
For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.
Example
' saParameterNames and saParameterValues are SafeArrays
' sURL is a string
' oAuthManager is a Commerce AuthManager object
saParameterNames(0) = "sku"
saParameterValues(0) = "12345"
sURL = oAuthManager.GetURL("filename.asp", False, True, _
saParameterNames, saParameterValues)
' sURL = http://host_name/virtual_directory/filename.asp?sku=12345&MSCSAuth=Q0H4SE915ASH2KC000Q79QB1E