08-03-05 01:59 AM
Hey Jim,
That error is: 16395 Error Profile object already exists.
What does the profile definition look like? You haven't altered the schema
and made PageGroup a key in the TargetingContext profile definition, have
you?
The key should be a unique id (GUID) value. Each unique request and thus
unique instance of CommerceContext.Current should generate a new GUID value
for that when you access CommerceContext.Current.TargetingSystem (a
TargetingSystemInfo object). It then calls CreateProfile with the newly
generated GUID and that profile instance becomes the
TargetingContextProfile for that request. Note that there should be no
backing store for these profile instances - they are in-memory only profile
instances. I suspect you're hitting a collision with another profile
instance already in cache on that machone somehow.
-djm
--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2005 Microsoft Corporation. All rights
reserved.
--------------------
From: "BeerBoy" <jim.macaulay@framfab.com>
Subject: Setting the PageGroup gives an error on page refresh
Date: 13 Jul 2005 06:37:33 -0700
I have a page which displays a banner ad using the 'PageGroup'
functionality. All works, except when you hit the browser 'refresh'
button (or when a Postback is performed !). Anyway, the line which sets
the PageGroup fails.
Has anyone else seen this or can anyone eplain why this is ?
Thanks
Jim
Error trace :
COMException (0xc100400b): Exception from HRESULT: 0xC100400B.]
ADODB.Field.set_Value(Object pvar) +0
Microsoft.CommerceServer.Runtime.Profiles.ProfileProperty.set_Value(Object
value)
[CommerceProfileSystemException: Failed to set value for profile
property 'PageGroup'.]
Microsoft.CommerceServer.Runtime.Profiles.ProfileProperty.set_Value(Object
value)
Oyster.Epson.BuyEpson.Web.JimTest.PageGroupAd.Page_Load(Object
sender, EventArgs e) in
d:\projects\buyepson\oyster.epson.buyepson.web\jimtest\pagegroupad.aspx.cs:5
2
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
My code is pasted below
private void Page_Load(object sender, System.EventArgs e)
{
string bannerSize = "Half";
Profile currentUser;
UserProfile formattedCurrentUser;
// A formatted form of a user profile to allow me easy access to
properties
formattedCurrentUser =
UserProfileManager.GetLibraryProfileForCurrentUser(false);
currentUser =
CommerceContext.Current.ProfileSystem.GetProfile(Constants.CS2002_USER_ID,fo
rmattedCurrentUser.ID,Constants.CS2002_USER_OBJECT);
CommerceContext csContext = CommerceContext.Current;
//
// Get a ContentSelector and set its properties
//
// The next line fails on postback ????????????????????????
csContext.TargetingSystem.TargetingContextProfile["PageGroup"].Value
= "JimsGroup";
ContentSelector cso =
csContext.TargetingSystem.SelectionContexts["advertising"].GetSelector()
;
cso.Profiles.Add("targetingContext",
csContext.TargetingSystem.TargetingContextProfile);
// Even the trying the following way fails !!!
//((Profile)cso.Profiles["targetingContext"])["PageGroup"].Value =
"JimsGroup";
cso.Profiles.Add("user", currentUser);
cso.TraceMode = true;
cso.ItemsRequested = 10;
cso.Size = bannerSize;
//
// Get some content
//
StringCollection content = cso.GetContent();
//
if (content.Count > 0)
{
Literal1.Text = content[0];
}
}
[ Post a follow-up to this message ]
|