AuthManager.GetURL Method (PIA)

Use this method to generate an encoded Uniform Resource Locator (URL) string.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Function GetURL(FileName As String,
  fCookie As Boolean,
  fSecure As Boolean,
  Optional ByRef pVarURLParameters As Object,
  Optional ByRef pVarURLValues As Object) As String

[C#]

using Microsoft.CommerceServer.Interop;
…
string GetURL(stringFileName,
  boolfCookie,
  boolfSecure,
  refobjectpVarURLParameters,
  ref objectpVarURLValues);

Parameters

[Visual Basic .NET]

  • FileName
    A String that contains the file name to reference in the URL.
  • fCookie
    A Boolean that indicates whether the user allows cookies.
  • fSecure
    A Boolean that indicates whether the URL is secure (HTTPS versus HTTP).
  • pVarURLParameters
    A System.Array that contains a list of parameter names to include in the URL.
  • pVarURLValues
    A System.Array that contains values that correspond to the parameter names.

[C#]

  • FileName
    A string that contains the file name to reference in the URL.
  • fCookie
    A bool that indicates whether the user allows cookies.
  • fSecure
    A bool that indicates whether the URL is secure (HTTPS versus HTTP).
  • oVarURLParameters
    An object containing a System.Array of parameter names to include in the URL. If the array of parameters is not needed, pass a reference to an object set to DBNull.Value.
  • oVarURLValues
    An object containing a System.Array of parameter values that correspond to the parameter names in oVarURLParameters. If the array of parameters is not needed, pass a reference to an object set to DBNull.Value.

Return Values

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

[C#] This method returns a string with the encoded URL.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

[Visual Basic .NET]

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

Value Description
&HC1004C24 This method should only be called within an ASP page.
&HC1004C10 The Initialize method must be called with the installed site name before calling this method.

[C#]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
0xC1004C24 This method should only be called within an ASP page.
0xC1004C10 The Initialize method must be called with the installed site name before calling this method.

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.

Ee797836.note(en-US,CS.20).gif 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.

[Visual Basic .NET]

Example

' saParameterNames and saParameterValues are System.Arrays
' 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

Requirements

Namespace: Microsoft.CommerceServer.Interop

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsauthlib (in mscsauthlib.dll)

See Also

AuthManager Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.