ASP.NET-Based Advertising Sitelet

Location in SDK: SDK\Samples\ASPNET\Ad Sitelet

The primary goal of the Advertising Sitelet is to demonstrate the use and behavior of the components that work together to display advertisements in a Commerce Server site. In this sitelet, you will view a demonstration of targeted advertisements for hard-coded profile data to learn and understand how the ContentSelector object works. The profile data for this sitelet is stored in the site SQL Server database; this database is populated by Commerce Server Site Packager during the sitelet installation process.

The Advertising Sitelet consists of a package file, which you unpack using Commerce Server Site Packager. The source code for the sitelet is included in this package. Using the sitelet, you can create and display ads using the Campaign Manager module, and you can manage ad targeting based on profiles in your Profiles database. No modification to the source code is required to deploy the Advertising Sitelet to a server running Commerce Server 2002.

Similar functionality to that found in the ASP.NET-Based Advertising Sitelet can be found in the ASP-Based Advertising Sitelet. For more information, see ASP-Based Advertising Sitelet.

Best coding practices are maintained in this sample, and the code represents the prescribed method of using the object model.

ASP.NET-Based Advertising Sitelet Code Notes

Installing the ASP.NET-Based Advertising Sitelet

ASP.NET-Based Advertising Sitelet Code Notes

This sitelet demonstrates multilingual functionality. The following languages are supported: English, French, German, and Japanese. The ASP.NET sitelets set the language character sets in the Page_Init functions of several ASPX pages using code such as the following:

strLanguage = coll[Utility.languageLabel];
try {SelectedCulture = CultureInfo.CreateSpecificCulture(strLanguage);}
catch(Exception e) {
SelectedCulture = CultureInfo.CreateSpecificCulture(Utility.englishLanguage);
strLanguage = Utility.englishLanguage;
}

Installing the ASP.NET-Based Advertising Sitelet

You unpack the Advertising Sitelet using Commerce Server Site Packager. The package file for the ASP version of the Advertising Sitelet is located in the following directory:

<drive>:\Program Files\Microsoft Commerce Server 2002\SDK\Samples\ASPNET\Ad Sitelet\SDK-ADSITELET-ASPNET.PUP

Use the following procedure to install the Advertising Sitelet on one computer using the Quick mode in Site Packager.

Unpacking the ASP.NET-based Advertising Sitelet using the Custom unpack option and creating independent databases for each of the site resources is not recommended.

To unpack the ASP.NET-Based Advertising Sitelet

  1. In Windows Explorer, navigate to the <drive>:\Program Files\Microsoft Commerce Server 2002\SDK\Samples\ASPNET\Ad Sitelet directory.

  2. Click the SDK-ADSITELET-ASPNET.PUP icon.

  3. In the Unpack screen, select Quick Unpack, and then click Next.

  4. In the Quick Unpack screen, ensure that the SQL Server computer name is correct, type the SQL Server login name and password, and then click Next.

  5. In the Commerce Server Site Packager window recommending Windows Authentication, click OK.

    By default, the sitelets do not work with Windows Authentication. For more information about configuring the sitelets to work with Windows Authentication, see step 6 in Deploying Commerce Server Using Windows Authentication.

  6. In the Profiling System screen, accept the defaults, and then click Next.

  7. In the second Profiling System screen, accept the defaults, and then click OK.

  8. After the unpacking is complete, a dialog box appears with the message "Unpacking is complete!". Click Finish.

  9. In Internet Explorer, in the Address box, type HTTP: //<computer name>/netAdSitelet to open the sitelet.

See Also

ASP.NET-Based Catalog Sitelet

ASP.NET-Based Order Sitelet

ASP.NET-Based Profile Sitelet

Catalog Web Service

Example code for the Microsoft.CommerceServer.Runtime.Targeting Namespace

Copyright © 2005 Microsoft Corporation.
All rights reserved.