Setting the PageGroup gives an error on page refresh
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Setting the PageGroup gives an error on page refresh

 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server
Author Message
BeerBoy
Guest





Posted: Wed Jul 13, 2005 4:53 pm    Post subject: Setting the PageGroup gives an error on page refresh Reply with quote

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:52
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,formattedCurrentUser.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];
}
}
Back to top
David Messner [MSFT]
Guest





Posted: Wed Aug 03, 2005 12:51 am    Post subject: RE: Setting the PageGroup gives an error on page refresh Reply with quote

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];
}
}
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Commerce Server All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB