Advertising Pipeline & AJAX UpdatePanel

We've added an ASP.NET Ajax Update Panel to the Starter Site and we are getting an error in the Advertising Pipeline

PIPELINE:++ component[0xA] about to be called ProgID: Commerce.CSFSaveHistory.1
RootObject: ReadValue _history VT_BSTR VT_EMPTY __empty__
PIPELINE:-- component [0xA] returned hr: 0x80004005, IErrorLevel=4 in 31 milliseconds
Error Description: Component Execution failed for component[0xA] hr: 0x80004005
ProgID: Commerce.CSFSaveHistory.1
Server cannot modify cookies after HTTP headers have been sent.

This makes sense to me. You can't update cookies on a UpdatePanel postback. Is there a recommended approach to using AJAX on the starter Site without running into this problem.

[746 byte] By [WilliamHickson] at [2008-1-10]
# 1

The history can also be saved in the user's profile or the asp session collection. The former should help you. The latter may or may not with Ajax. More info at http://msdn2.microsoft.com/en-us/library/ms960061.aspx and to actually change the setting you'll have to edit advertising.pcf with the pipeline editor.

Hope this helps,

David

DavidLott-MSFT at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 2
Thanks, David. We resolved it by not retrieving the CSF content for AJAX postbacks. The ad content is not in the UpdatePanel so the changed content would not appear anyway.
WilliamHickson at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 3
How did you resolve this? can you post your code?
Rathbird at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 4

I bypassed the code giving me trouble using the following condition. The condition is true if the post is a result of an AJAX UpdatePanel postback.

if (HttpContext.Current.Request.Headers["X-MicrosoftAjax"] != null)

WilliamHickson at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 5

William,

I very much appreciate you answering my questions! I am completely new to Commerce Server, and I'm currently wrapping the product list control in an update panel. Using the starter site, I can't see where the pipeline control is getting called. The two pages involved are browse.aspx and productlist.ascx, in which code behind did you place the check, and in what event? the only event exposed currently is oninit in browse. Am I making any sense?

Robin

Rathbird at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...
# 6

The advertising pipeline is called as a result of the CommerceComponent server control MarketingItem being on the StandardLayout masterpage. I put the code for the bypass in the MarketingItem.GetContent method, essentially doing nothing when the method is called as a result of an Ajax postback.. Note that this may cause problems if your marketing item is inside your UpdatePanel but it sounds like you're safe on that count.

You have the source for the CommerceComponents in a zip file in your StarterSite installation directory.

WilliamHickson at 2007-10-3 > top of Msdn Tech,Commerce Server,Commerce Server 2007...