If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > losing cookies and changing session.id, ... why?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-04, 01:47
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
Question losing cookies and changing session.id, ... why?

I have developed a web application using IIS 5.1 and asp pages and IE 6.0.

From the login page(login.asp), it goes to another asp page(adddata.asp) on which there is a form with several buttons that use javascript to open new asp pages(T1.asp, T2.asp, T3.asp, etc.), depending on which button was clicked. If a button is clicked it opens the new browser window and keeps the adddata.asp page open. T1.asp and T2.asp, etc. is have forms and one submitted writes the data into cookies. Once the adddata.asp page is submitted it goes to recorded.asp and writes all the collected data from cookies and session variables into the database.

Problem is that it loses some of the cookies if more than 2 new windows are opened. If forms on adddata.asp, T1.asp and T2.asp are filled in and submitted it works fine, but I cannot go any further than this because it drops cookies, and not always the same ones either. It also changes the session.id even though there has been no change in domain or even directory.

What am I doing wrong?
Reply With Quote
  #2 (permalink)  
Old 02-09-04, 01:51
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Are you able to post some of your pages so we can have a look at exactly what you are trying to do??
Reply With Quote
  #3 (permalink)  
Old 02-09-04, 17:48
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
Thumbs up

Attached is the main form that contains the several buttons.

Thanks.
Attached Files
File Type: txt adddata.txt (13.1 KB, 46 views)
Reply With Quote
  #4 (permalink)  
Old 02-09-04, 17:50
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
and here is one of the asp pages that loses the cookies...
Attached Files
File Type: txt t3.txt (7.0 KB, 42 views)
Reply With Quote
  #5 (permalink)  
Old 02-09-04, 18:05
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
so when you say it is losing cookies... which of these values does it lose?

UserKPI
ClientName
Reason_T3_
Date_T3_
ConNote_T3_
T3Attempt_

Or does it lose them all??
Reply With Quote
  #6 (permalink)  
Old 02-10-04, 16:55
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
It usually loses only a few cookies and not always the same ones. Mostly it loses a few of these:

Reason_T3_x
Date_T3_x
ConNote_T3_x
T3Attempt_ x

With x being 1,2,3 etc. it will write 1 and 2 and then drop 3, or 3 and drop 1 and 2... weird stuff. That's why I don't think it's the code.

:-)
Reply With Quote
  #7 (permalink)  
Old 02-10-04, 17:22
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
No disrespect intended but, I think it might be the code... if it was the browser I think it would be less erratic. I'll find some time this afternoon to have a good go over the code. I suspect it has something to do with this

Code:
Dim varT3_2
varT3_2 = request.cookies("T3cookie") 	
x=1
For x=1 to varT3_2
	Response.Cookies("UserKPI")=request.cookies("UserKPI")
	Response.Cookies("ClientName")=request.cookies("ClientName")
	Response.Cookies("Reason_T3_" & x)=request("Reason_T3_" & x)
	Response.Cookies("Date_T3_" & x)=request("Date_T3_" & x)
	Response.Cookies("ConNote_T3_" & x)=request("ConNote_T3_" & x)
	Response.Cookies("T3Attempt_" & x)=request("T3Attempt_" & x)
next
But I'm not sure why.... are you setting the T3cookie correctly because I can't find any other reference to it.

Last edited by rokslide; 02-10-04 at 17:25.
Reply With Quote
  #8 (permalink)  
Old 02-10-04, 20:45
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
I would really appreciate your time. It may very well be my code. The T3cookie is set at the top of the T3.asp page. Is that where I am going wrong?

Dim varT3
varT3 = request("T3")
response.cookies("T3cookie") = varT3
Reply With Quote
  #9 (permalink)  
Old 02-10-04, 21:20
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Hmmm,.. okie, well I have had a look and I can't see anything wrong with it to be honest,... do you have this up somewhere where I can play with the whole thing just to see the behaviour you have meantioned?

Just a thought,... if you are losing your session id, or rather it is changing, it almost infers that your conneciton is being dropped,... what sort of server software are you using?

Last edited by rokslide; 02-10-04 at 21:24.
Reply With Quote
  #10 (permalink)  
Old 02-10-04, 21:52
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
Sorry - it is only on our intranet. No web access is possible because if the location of the database. The web server has Windows XP, IIS 5 and the web pages connect to another server that has Oracle 8 installed. How can I test to see if the connection is being dropped?

Thanks for the help... can you think of anything else I can try?
Reply With Quote
  #11 (permalink)  
Old 02-10-04, 22:58
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Apart from running a pile of debugging on the scripts I can't really think of anything.... You might be right, it might be the server causing the problems... I can't really be sure though...

Doing the debugging should prove it though.
Reply With Quote
  #12 (permalink)  
Old 02-11-04, 18:17
webmistress webmistress is offline
Registered User
 
Join Date: Jan 2004
Location: Sydney
Posts: 11
What I have had to do is redesign my pages so that the buttons did not open a new page but rather slotted in a few extra lines on the form on the same page. It works, and does not lose any cookies.

Code:
<td colspan="2" align="right">Total number of containers not put away </td>
<td colspan="2">
<input name="W3" type="text" id="W3" size="5" value="<% = valueW3 %>">
<INPUT name="button3" type="submit" id="button3" onclick="return OnButton3();" value="more.."> 
Click on more to capture details </td>
<% If request.cookies("button3")="more.." then %>
<% If request("W3")>0 then %>               
<div id="W3">
<%
Dim varW3
varW3 = request("W3")
x=1
For x=1 to varW3

Set OraDynaset = OraDatabase.DbCreateDynaset( _
    "select * from W_Reasons where question='W3' order by Reason", cint(0))
fAttempt=Request("W3Attempt_" & x)
%>
	 <tr bgcolor="#F5F9FD"> <td><B>
	 <% = x %>.</B>  Error made by<br>
	 <% Select Case fAttempt
	  Case "us"  %>
	<input name="W3Attempt_<% response.write x%>" type="radio" value="us" checked>us
	<input name="W3Attempt_<% response.write x%>" type="radio" value="Cus">
			Client
			<% Case "Cus"  %>
			<input name="W3Attempt_<% response.write x%>" type="radio" value="us">us
			<input name="W3Attempt_<% response.write x%>" type="radio" value="Cus" checked>
			Client
			<% Case Else  %>		  
			<input name="W3Attempt_<% response.write x%>" type="radio" value="us" unchecked>us
			<input name="W3Attempt_<% response.write x%>" type="radio" value="Cus" unchecked>
			Client
			<% end select %>
                  
</td>
<td>Reason :<br>                
<select name="Reason_W3_<% response.write x %>">
<option ><% If Request("Reason_W3_" & x)<>"" Then Response.write Request("Reason_W3_" & x) Else Response.write "Select Reason" end if %></option><% Do While(OraDynaset.EOF = FALSE) %><option value="<% = OraDynaset.Fields("Reason") %>"><% = OraDynaset.Fields("Reason") %></option>
<% OraDynaset.MoveNext 
Loop
%></select></td>
              <td>Container. no.<br>
                <input name="Container_W3_<% response.write x%>" type="text" size="10" maxlength="20"> </td>
              <td>Date (dd/mm/yyyy): 
                <input name="Date_W3_<% response.write x%>" type="text" size="10"></td>
</tr>
<%
Next
%> 
</div>
<% end if %>
<% end if %>
Thanks Rokslide for the help.
Reply With Quote
  #13 (permalink)  
Old 02-11-04, 20:30
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Cool, all looks sweet. Since this is an intranet app you could probably get away without using cookies at all and instead use a hidden form field to how all the details (probably storing it as XML or something).

Also if you are moving it to a single page and thus not loosing your sessionid perhaps you could store everything in session variables...

Yet another thought would be to have a single page with div's for each section. You would have to use some DHTML to dynamicly create the required number of fields but it should work okie.

Anyhow, hope I was of some help. Sorry I couldn't solve the orginal problem.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On