Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Var working locally but not on live server?

Status
Not open for further replies.

sportypants

IS-IT--Management
Apr 26, 2001
18
0
0
GB
Please can anybody tell me what is wrong with this code? It works fine on IIS5 but not on my hosts server?

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<!--#include file=&quot;../Connections/AccesoneASP.asp&quot; -->
<%
Dim rsAccount__strUsername
rsAccount__strUsername = &quot;abc123&quot;
if (Session(&quot;MM_Username&quot;) <> &quot;&quot;) then rsAccount__strUsername = Session(&quot;MM_Username&quot;)
%>
<%
set rsAccount = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsAccount.ActiveConnection = MM_AccesoneASP_STRING
rsAccount.Source = &quot;SELECT * FROM tblClients WHERE ClientUsername = '&quot; + Replace(rsAccount__strUsername, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
rsAccount.CursorType = 0
rsAccount.CursorLocation = 2
rsAccount.LockType = 3
rsAccount.Open()
rsAccount_numRows = 0
%>
<%
Session(&quot;ClientID&quot;) = rsAccount.Fields.Item(&quot;ClientID&quot;).Value
%>
<%
Response.Redirect &quot;../default.asp&quot;
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
</body>
</html>
<%
rsAccount.Close()
%>

I get an EOF or BOF error on my hosts server but it creates the Sess Var ok on my local machine?

Please help.....arrghhhhhh

TIA
 
Your host probably does not allow Sessions because it eats up resources quickly
Write a cookie or use hidden fields or QueryString
 
as lesleint said check your hosts t&c's

Cheech

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Thanks for the replies, Ive asked my host and they say they are enabled, can you see anything wrong with my code?

Thanks,

JJ
 
Try running this code to see what is being selected and if there is a problem with when you assign the session variable.
Code:
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<!--#include file=&quot;../Connections/AccesoneASP.asp&quot; -->
<%
Dim rsAccount__strUsername
rsAccount__strUsername = &quot;abc123&quot;
if (Session(&quot;MM_Username&quot;)   <> &quot;&quot;) then rsAccount__strUsername = Session(&quot;MM_Username&quot;)  
%>
<%
set rsAccount = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsAccount.ActiveConnection = MM_AccesoneASP_STRING
rsAccount.Source = &quot;SELECT *  FROM tblClients  WHERE ClientUsername = '&quot; + Replace(rsAccount__strUsername, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
rsAccount.CursorType = 0
rsAccount.CursorLocation = 2
rsAccount.LockType = 3
Response.Write(rsAccount.Source)
rsAccount.Open()
rsAccount_numRows = 0
%>
<%
Session(&quot;ClientID&quot;) = rsAccount.Fields.Item(&quot;ClientID&quot;).Value
%>
<%
Response.Redirect &quot;../default.asp&quot;
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
</body>
</html>
<%
rsAccount.Close()
%>

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Cheech, thanks for trying to help, the message displaying is:

SELECT * FROM tblClients WHERE ClientUsername = 'abc123'
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/CMembers/setsession.asp, line 21

This obviously means that the session just isnt being created? I know the code works locally but are there any alterations I could try? I dont want to use cookies as they can be viewed and I really want to hide the client ID as they have invoices which are viewable online.

My host really isnt helpfull and apparently doesn't seem to know that much :(

Thanks for trying to help,

JJ
 
Try commenting out the following 2 lines, I have also added a response.write for the session variable to see what it holds.
Code:
<%@LANGUAGE=&quot;VBSCRIPT&quot;%>

<!--#include file=&quot;../Connections/AccesoneASP.asp&quot; -->
<%
Dim rsAccount__strUsername
Code:
'rsAccount__strUsername = &quot;abc123&quot;
'if (Session(&quot;MM_Username&quot;)   <> &quot;&quot;) then
Code:
rsAccount__strUsername = Session(&quot;MM_Username&quot;)  
%>
<%
set rsAccount = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsAccount.ActiveConnection = MM_AccesoneASP_STRING
rsAccount.Source = &quot;SELECT *  FROM tblClients  WHERE ClientUsername = '&quot; + Replace(rsAccount__strUsername, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
rsAccount.CursorType = 0
rsAccount.CursorLocation = 2
rsAccount.LockType = 3
Response.Write(rsAccount.Source)
Response.Write(Session(&quot;MM_Username&quot;))
rsAccount.Open()
rsAccount_numRows = 0
%>
<%
Session(&quot;ClientID&quot;) = rsAccount.Fields.Item(&quot;ClientID&quot;).Value
%>
<%
Response.Redirect &quot;../default.asp&quot;
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
</body>
</html>
<%
rsAccount.Close()
%>

I that doesnt work post the code where you assign the session variable

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Right, my host has finally uploaded my site to another account where it works perfectly? They have admitted that the problem seems to relate to the account they have created and not the site.

Thank you cheech for your patience and assistance, unfortunately the problem seems to lie with the account and not my code.

Your help is very mcuh appreciated.

Thanks again for your help,

Jason.
 
No probs

Cheech

[Peace][Pipe]
The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top