Asp Session state ??

R

Ron Vecchi

I'm pretty new to asp.

It seems that I am assigning to the session rather than comparing against.
I want to compare it in the first peice of code but it seems that I am
assigning to it. When the user first requests the page they are not a
member.


Heres my code:


If(Session("IsMember") = "True") then
'Do Nothing
End if

'should still not be True

If(Session("IsMember") = "True") then
Response.write("IS TRUE")
End If

'Response.write is working telling me that the first part of the code
assigned to the session
'Am I doing something wrong??
 
E

Egbert Nierop \(MVP for IIS\)

Ron Vecchi said:
I'm pretty new to asp.

It seems that I am assigning to the session rather than comparing against.
I want to compare it in the first peice of code but it seems that I am
assigning to it. When the user first requests the page they are not a
member.
Try this:

Dim isMember
isMember = Session("IsMember")

If isMember = True then

Else

End If

b.t.w. Your code should work normally. Maybe the issue is with "True"
(String) instead of True (boolean)
 
U

UR ednec

Insert these lines at the top of your ASP page:
<%
Response.Write("Session Variable Value: " & Session("IsMember"))
%>

If you dont see anything next to the above sentence then your assumption is
correct. If not, your assumption is wrong and you are setting the session
variable somewhere.

HTH
 
E

Evertjan.

Ron Vecchi wrote on 14 jul 2003 in
microsoft.public.inetserver.asp.general:
I'm pretty new to asp.

It seems that I am assigning to the session rather than comparing
against. I want to compare it in the first peice of code but it seems
that I am assigning to it. When the user first requests the page they
are not a member.


Heres my code:


If(Session("IsMember") = "True") then
'Do Nothing
End if

'should still not be True

If(Session("IsMember") = "True") then
Response.write("IS TRUE")
End If

'Response.write is working telling me that the first part of the code
assigned to the session
'Am I doing something wrong??

You are using serverside asp vbscript using far to much brackets and
using true as a string, not as a boolean.

Try:

=== /file1.asp:

<%
Session("IsMember") = True
%>

=== /file2.asp:

<%
If Session("IsMember") then
Response.write "'IsMember' IS TRUE<br>"
Else
Response.write "You are an intruder !<br>You skipped file1.asp"
End if
%>
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top