SessionID Still not working

G

Guest

I have written a shopping cart using ASP .NET (VB). It has been running
quite successfully on a site for about a year or so. I use the SessionID as
the key to hold information on the shopping cart.

I have copy / pasted the code into a new site. Everything is working,
EXCEPT for the shopping cart holding the SessionID. I have watched the
variable, and each time I hit the 'Update' button in a datalist, the session
ID changes. That is a HUGE problem, and I am about to throw a computer out a
window.

The session ID is supposed to stay the same!!! Where do I look? The sites
are on the same server. IIS 6.0 W2K3 server and updated patches.

I am using a datalist to display the cart that is stored in the database
using the sessionID as the key. The datalist uses LinkButtons (update |
delete) to run code that updates the QTY or deletes the item all together.
Again, this is all of the same code that I have been using on another site
for more than a year, and works fine.

The cart code is all on one page, and posts back to itself. I wrote code
that displays the sessionid on the top of the page, and it changes when I hit
the update or delete buttons. On the site that works, this does not happen.

I have gone back to the site that works, and have checked all of the session
settings that I could find, and the only one I found was in the web.config
file (as expected). I copy / pasted that session state code into the new
site, and the session cookie is still not working correctly.

Code Snippets From Web.Config:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="30"
/>

What else can be wrong? I HOPE it is not a bug with .NET, and it is a
configuration difference of the two sites, even though I have gone through
them with a fine tooth comb. How can it be the code, since it is working on
another site? I am not saying that it isn't my code, but I want to know what
could be wrong with it, if it works elsewhere.

Thanks in advance,
 
K

Kumar Reddi

Hi Brad,
It looks like the machine you are having problems with seem to have some
tight security, which is not accepting cookies. Try reducing the security
level and see to make sure it accept the cookies. asp.net by default make
use of cookies to store the sessionID
 
G

Guest

Brad..
Try what Kumar Adviced and see if it will solve your problems..
I guess it should!
Patrick
 
G

Guest

It is not the client. I checked the settings, and it is set to allow
cookies. Not to mention it does not work in a test environment
(localhost/<BadCart>), but the other site does in the same test environment
(localhost/GoodCart>).

The exact same issues are in production. I have both carts on the same
production server (there is no reference from the live site to the bad cart).
The domain the bad cart is on is set to allow cookies, also, and it still
exhibits the same behavior.

Kumar Reddi said:
Hi Brad,
It looks like the machine you are having problems with seem to have some
tight security, which is not accepting cookies. Try reducing the security
level and see to make sure it accept the cookies. asp.net by default make
use of cookies to store the sessionID
 
K

Kumar Reddi

Brad,
Lets assume there is nothing wrong with the cookie permission. How about,
trying a cookieless session. Try setting Cookieless = true, in the
sessionState element. Now your sessionID will be part of the url. Just try
doing this for testing purposes. See, if each postback changes the sessionID
in the url. Let me know what you found
--
Kumar Reddi
http://kumarreddi.blogspot.com

Brad Simon said:
It is not the client. I checked the settings, and it is set to allow
cookies. Not to mention it does not work in a test environment
(localhost/<BadCart>), but the other site does in the same test
environment
(localhost/GoodCart>).

The exact same issues are in production. I have both carts on the same
production server (there is no reference from the live site to the bad
cart).
The domain the bad cart is on is set to allow cookies, also, and it still
exhibits the same behavior.
 
G

Guest

Yes, it does work that way. I have tried it before and it works fine.

Assuming I have everything right (big assumption), does anyone know if there
are any issues that ASP .NET has with with cookie sessions? It is not like I
am new to using a session cookie, or cookies at all. I have been monkeying
around with this for 4 weeks now.

I am still open to trying anything. The cookieless session is not an option
(unfortunately), it is not my decsion on that. They don't like the funny
looking URLs it does.

A thought I just had. Their is no difference in the code of the shopping
cart at all. The page (cart.aspx) is the only one that even uses the session
variable, and it looses the session id without even leaving the page
(clicking the update or delete buttons). The only other difference I can
think of between the two sites is the rest of the site. Parts of the bad
cart site is ASP pages (again, not my choice), the good cart is 100% ASP
..NET. Is THAT the issue? I don't see how it would be since the session id
gets lost without even leaving the page.
 
K

Kumar Reddi

Hi Brad,
It certainly looks like the issue with your case is having both asp and
asp.net pages together. I never developed an application which had both the
kinds of pages. But, as I am aware you need to provide both Global.asa and
Global.asax, as application information is provided differently and accessed
differently for each type of the page. Do you have both these Global's?
 
G

Guest

DING DING DING DING - you win!!!! Thank you so very much.

That is what I get when I let a client do some of the work. He developed in
ASP, I brought the project in, and then added ASPX pages as needed.

I did not have EITHER of those pages. I put a basic one of each, and it
works. It could easily have only needed the ASAX page.

I KNEW it would be something simple I overlooked.

Thanks again, you don't know what a pain this has been!
 

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,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top