|
Home > Archive > Content Selection Framework > September 2004 > SelectionContexts("Discounts").GetSelector()
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
SelectionContexts("Discounts").GetSelector()
|
|
| Mark Meehan 2004-09-22, 9:48 pm |
| CommerceContext.Current.TargetingSystem.SelectionContexts(ctxt).GetSelector().GetContent().Count
returns 0 unless I put a break point on this line and step over the
call. It will work correctly if I step through the code. If I run
outside of the debugger or I run from the debugger and put a
breakpoint past this call, it always returns a count of 0. Any help
would be great.
For example:
Dim ctx As CommerceContext = CommerceContext.Current
Dim ctxt As String = selectionContextVal.ToString
Dim cso As ContentSelector
<BREAK POINT> cso =
CommerceContext.Current.TargetingSystem.SelectionContexts(ctxt).GetSelector()
<STEP OVER>
If Not cso Is Nothing Then
CommerceContext.Current.TargetingSystem.TargetingContextProfile("PageGroup").Value
= pageGroupVal
Dim userLanguage As String = Nothing
If ctx.AuthenticationInfo.IsAuthenticated() Then
Dim userProfile As Profile = ctx.UserProfile
If Not userProfile Is Nothing Then
cso.Profiles.Add("User", userProfile)
End If
End If
ctx.TargetingSystem.TargetingContextProfile("Culture").Value
= cultureVal
cso.ItemsRequested = 1
cso.Size = sizeVal.ToString
cso.Profiles.Add("targetingContext",
ctx.TargetingSystem.TargetingContextProfile)
cso.TraceMode = traceModeVal
If history <> "" Then
cso.PageHistory = history
End If
Dim Ads As StringCollection = Nothing
Try
Ads = cso.GetContent()
Catch
End Try
history = cso.PageHistory
If (Not Ads Is Nothing) Then
If (Ads.Count > 0) Then
Return Ads
End If
End If
Return Nothing
End If
| |
| David Messner [MSFT] 2004-09-29, 8:03 pm |
| I notice you are catching and eating all exceptions below. Are you sure
you're not getting an exception that you are silently ignoring? You could
set VS.NET to break on all exceptions to check.
I'm not sure we have enough information to go on to help you with this one.
Is there any event in the application event log?
What is the relevance of your <BREAK POINT> tags in the snippet below? Are
you saying that if you don't break here that the cso object is null or
something?
<BREAK POINT> cso =
CommerceContext.Current.TargetingSystem.SelectionContexts(ctxt).GetSelector(
)
<STEP OVER>
best
-djm
--
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2004 Microsoft Corporation. All rights
reserved.
--------------------
From: mark.meehan@gmail.com (Mark Meehan)
Newsgroups: microsoft.public.commerceserver.campaigns_csf
Subject: SelectionContexts("Discounts").GetSelector()
Date: 17 Sep 2004 08:39:23 -0700
Organization: http://groups.google.com
Lines: 64
Message-ID: <7d046a9a.0409170739.22da8740@posting.google.com>
NNTP-Posting-Host: 199.199.209.149
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1095435567 10883 127.0.0.1 (17 Sep 2004
15:39:27 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 17 Sep 2004 15:39:27 +0000 (UTC)
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP0
8.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!fr.ip.ndsoftware.net!proxad
.net!postnews2.google.com!not-for-mail
Xref: cpmsftngxa06.phx.gbl
microsoft.public.commerceserver.campaigns_csf:2850
X-Tomcat-NG: microsoft.public.commerceserver.campaigns_csf
CommerceContext.Current.TargetingSystem.SelectionContexts(ctxt).GetSelector(
).GetContent().Count
returns 0 unless I put a break point on this line and step over the
call. It will work correctly if I step through the code. If I run
outside of the debugger or I run from the debugger and put a
breakpoint past this call, it always returns a count of 0. Any help
would be great.
For example:
Dim ctx As CommerceContext = CommerceContext.Current
Dim ctxt As String = selectionContextVal.ToString
Dim cso As ContentSelector
<BREAK POINT> cso =
CommerceContext.Current.TargetingSystem.SelectionContexts(ctxt).GetSelector(
)
<STEP OVER>
If Not cso Is Nothing Then
CommerceContext.Current.TargetingSystem.TargetingContextProfile("PageGroup")
.Value
= pageGroupVal
Dim userLanguage As String = Nothing
If ctx.AuthenticationInfo.IsAuthenticated() Then
Dim userProfile As Profile = ctx.UserProfile
If Not userProfile Is Nothing Then
cso.Profiles.Add("User", userProfile)
End If
End If
ctx.TargetingSystem.TargetingContextProfile("Culture").Value
= cultureVal
cso.ItemsRequested = 1
cso.Size = sizeVal.ToString
cso.Profiles.Add("targetingContext",
ctx.TargetingSystem.TargetingContextProfile)
cso.TraceMode = traceModeVal
If history <> "" Then
cso.PageHistory = history
End If
Dim Ads As StringCollection = Nothing
Try
Ads = cso.GetContent()
Catch
End Try
history = cso.PageHistory
If (Not Ads Is Nothing) Then
If (Ads.Count > 0) Then
Return Ads
End If
End If
Return Nothing
End If
|
|
|
|
|