Session State and debugging the code behind

M

moondaddy

I'm writing a shopping cart in vb.net and for the first time I'm working
with session state on the server. I'm using it to maintain the user's
shopping cart for the session. in the browser is a datagrid with a listing
of products. If I put a break point in the code behind the code execution
will break at that point just as you would expect. When the user clicks on
an item in the grid it executes a line of jscript listed below which posts
the item to the shopping cart:
parent.data.frameElement.src="data.aspx?Task=CartAddNew&sku=" + sku;

However, this only works correctly the first time a grid item is clicked on.
if the user clicks on any of the previous clicked on items the line above
will run and I can see the shopping cart summary update in the page (which
means that the code behind is executing), but none of the code behind will
break on the break points. This only started happening after I started
using session state on the back end. Is it possible that session state is
causing this and do you have any ideas on how to begin trouble shooting
this? Its like a ghost I can't identify.

Thanks.
 
M

[MSFT]

Hello,

Thank you for using the community. From the description, it is hard to tell
if this problem is related to the session. More source code may provide
useful detail information about the problem.

Generally, when the script is executed, the page will be refresh and code
in Form_Load will be executed. You may set a break point at the beginning
of this sub to see if it will be executed, or you can add some debug code
like:

Response.Write "Here has been executed"

This will indicate if a sub has been executed.

Additionally, since it work in the first time, but failed later, you may
check the client source code to see if there is any difference between them.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
M

moondaddy

I already tried your suggestion by putting alerts in the jscript which
flagged where the code was executing. I also but numerous break points
through out the code behind. All code was in fact executing because the
code behind was recalculating the shopping cart total with each postback,
but the code behind stopped breaking on the break points once I clicked on a
shopping cart item for the 2nd time. Since this is running in a frames
page, could that have anything to do with this? I wouldn't thing so because
all shopping cart functionality happens via a hidden frame and an aspx page
called data.aspx (meaning that i'm not using various frames and or pages to
make the round trips).
 
M

[MSFT]

If you right click in the frame and select "Refresh", will the break
points get fired? Also, as I suggest, add some code in the code behind like:

Response.Write "Here has been executed"

Have you seen the line "Here has been executed" after click the item for
second time?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top