One of collage was facing issue when he tries to get Advertisement content selector.  On below code he used to get the error.

ContentSelector adcontent = CommerceContext.Current.TargetingSystem.SelectionContexts["advertising"].GetSelector();

He was new to commerce server and he was getting System.NullReferenceException as shown below.

image 

You will get such errors if targeting context details are not properly configured in web.config. Couple of checks you can make.

1. Make sure CommerceServerSelectionModule exist in <httpModules>

      <add name="CommerceContentSelection" type="Microsoft.CommerceServer.Runtime.Targeting.CommerceContentSelectionModule, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

2. Make sure Advertisement entry is properly configured in contentselection settings

<contentSelection>

      <add name="Advertising" cacheName="Advertising" selectionPipeline="advertising" eventPipeline="recordevent" redirectUrl="./redir.aspx"/>

    </contentSelection>

After performing both changes, we are able to get the advertisement content selector.

Related Articles


If you like this post, please click on our sponsor advertisement.


Leave a Reply

Follow me on Google+
Add to circles

In 0 people's circles

Sign up for Newsletter