Using the coBrandArgs Parameter for Flexible-Layout Cobranding
Using the coBrandArgs Parameter for Flexible-Layout Cobranding
The Microsoft® .NET Passport service pages pass the query string parameters PP_PAGE and PP_SERVICE when calling your site's cobranding template file in order for you to provide context-sensitive cobranding. In addition to these parameters, you can pass your own custom parameters to the cobranding template by using the optional coBrandArgs parameter of the Passport Manager methods that direct the user to the .NET Passport server, such as LoginUser, AuthURL2, and LogoTag2. This allows you to further customize cobranding.
The coBrandArgs parameter is subject to a 256-character limit as enforced by the Passport Manager object because this information is all passed in the header in string form. Therefore, it is advisable to keep query string parameter names and values used for coBrandArgs relatively short.
You must escape special characters in the coBrandArgs string or the URL generated by .NET Passport service pages to access your cobranding template will be malformed. For this reason, you should use the Server.URLEncode method in your Active Server Pages (ASP) pages to URL-encode your coBrandArgs string before using it in a call to LogoTag2 or any of the other methods that accept the coBrandArgs parameter.
Using the coBrandArgs Parameter
The following code demonstrates the use of the coBrandArgs parameter. As a typical .NET Passport-enabled page, this example uses the LogoTag2 method to sign in or out of .NET Passport. In this case, the query string parameter area is assigned a value of "VIP". This is URL-encoded in the call to LogoTag2. When the user clicks the Sign In or Sign Out button, the corresponding .NET Passport page will pass the area parameter to the participating site's cobranding template file.
<% Dim oMgr, TimeWindow, ForceSignin, thisURL, CoBrandArgs, LanguageID Set oMgr = Server.CreateObject("Passport.Manager") TimeWindow = 3600 ForceSignin = False thisURL = "https://www.mysite.com/default.asp" If (oMgr.FromNetworkServer = True) Then Response.Redirect(thisURL) End If CoBrandArgs = "area=VIP" 'this will get encoded %> <HTML> <!-- HTML nav bar--> <%= oMgr.LogoTag2(Server.URLEncode(thisURL), TimeWindow, ForceSignin, Server.URLEncode(CoBrandArgs)) %> <!-- content--> </HTML>
The following example shows how a participating site's cobranding template is included in the source HTML for a .NET Passport Sign-in page that uses flexible-layout cobranding. In this case, a coBrandArgs parameter of "area%3dVIP" was passed by the participating site to a Passport Manager method to generate the link that brought the user to the Login server. The area parameter can then be evaluated by the cobranding template to provide customized cobranding.
<SCRIPT language="JavaScript"
SRC="https://WWW.[your site].com/template.asp?area=VIP&lid=1033&PP_SERVICE=login">
</SCRIPT>
For an example cobranding template file that works with the Passport Manager calls detailed in the preceding example, see Flexible-Layout Cobranding (Branching Example).
See Also