Share via


IMSCSAuthManager2::GetURL Method

Use this method to generate an encoded URL string.

HRESULT IMSCSAuthManager::GetURL(
    BSTR FileName,
    BOOL fCookie,
    BOOL fSecure,
    VARIANT* pVarURLParameters,
    VARIANT* pVarURLValues,
    BSTR* pbstrRet
);
Function GetURL(
    FileName As String,
    fCookie As Boolean,
    fSecure As Boolean,
    Optional pVarURLParameters As Variant,
    Optional pVarURLValues As Variant
) As String

Parameters

  • FileName
    [C++]

    [in] A BSTR that contains the file name to reference in the URL.

    [Visual Basic]

    [in] A String that contains the file name to reference in the URL.

  • fCookie
    [C++]

    [in] A BOOL that indicates whether the user allows cookies.

    [Visual Basic]

    [in] A Boolean that indicates whether the user allows cookies.

  • fSecure
    [C++]

    [in] A BOOL that indicates whether to output a secure URL (HTTPS). See the Remarks section for more information about using this parameter.

    [Visual Basic]

    [in] A Boolean that indicates whether to output a secure URL (HTTPS). See the Remarks section for more information about using this parameter.

  • pVarURLParameters
    [C++]

    [in, optional, defaultvalue (NULL)] A pointer to a VARIANT containing a SAFEARRAY of parameter names to include in the URL.

    [Visual Basic]

    [in, optional] A SafeArray that contains a list of parameter names to include in the URL.

  • pVarURLValues
    [C++]

    [in, optional] A pointer to a VARIANT containing a SAFEARRAY of parameter values that correspond to the parameter names.

    [Visual Basic]

    [in, optional] A SafeArray that contains values that correspond to the parameter names.

  • pbstrRet
    [C++]

    [out, retval] A pointer to a BSTR used to return the encoded URL. [Visual Basic]

    Not applicable

Return Value

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a String that contains the encoded URL.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM error that this method can return.

Constant

Value

Description

E_UPM_AUTHMANAGER_API_ASP_ONLY

[C++] 0xC1004C24

[Visual Basic] &HC1004C24

This method should only be called within an ASP page.

MSG_UPM_AUTH_SITE_NEEDED_ERROR

[C++] 0xC1004C10

[Visual Basic] &HC1004C10

The Initialize method must be called with the installed site name before calling this method.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++] The pbstrRet parameter contains valid data only if the method completes successfully.

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).

Set the fSecure flag to True if you want to output a URL based on the securehostname property of the site. The Enable HTTPS property of the site must be True and the securehostname property of the site must be valid to output a valid secure URL.

Use the URLArgs or URLShopperArgs methods to encode a URL query string out of name/value pairs.

Example

' saParameterNames and saParameterValues are SafeArrays.
' sURL is a string.
' oAuthManager is a AuthManager object.

saParameterNames(0) = "sku"
saParameterValues(0) = "12345"

' Output a secure URL.
sURL = oAuthManager.GetURL("filename.asp", False, True, _
 saParameterNames, saParameterValues)

' sURL = https://secure_host_name/virtual_directory/filename.asp?sku=12345&MSCSAuth=Q0H4SE915ASH2KC000Q79QB1E.

' Output an insecure URL.
sURL = oAuthManager.GetURL("filename.asp", False, False, _
 saParameterNames, saParameterValues)

' sURL = http://insecure_host_name/virtual_directory/filename.asp?sku=12345&MSCSAuth=Q0H4SE915ASH2KC000Q79QB1E).

See Also

Other Resources

AuthManager Object