Results 1 to 5 of 5

Thread: Variable Comparisons ...

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Alberton, Gauteng, South-Africa
    Posts
    48

    Question

    Hey Guy's ..

    Yes it it I ... Again .... With another problem for the Dev-Demmie-Gods

    So to begin here's my code:
    *************
    'Checks the Session Variable "State" to see if user used correct route to enter the Site'

    chSession = Trim(Session("state"))
    chString = Trim(Request.Querystring("sStatus"))

    if chSession <> chString then
    Response.Write "It didn't worked"
    Response.End
    'Response.Redirect "http://www.newsclip.co.za/asp/temp.html"
    Else
    Response.Write "It worked<br>"
    End If
    *************

    Now what this code is supposed to to is this ....
    The Session("status") is a Random number red into the Session ("status") variable ...the same variable is read into the Querystring .. the idea behind this is that a User has to through a certain page so that the Audit trail can be invoked.

    Now my problem is that no matter what opperator I use = or <> I can't seem to be able to compare them .. I wrote them into the same page and they are the same .. In thought that there might be a problem with Spaces that's why i used the Trim() ..

    You can test this here:
    http://www.newsclip.co.za/clients.asp

    Thanks in Advance!
    Last edited by Randhart; Feb 28th, 2001 at 06:49 AM.
    ;-)
    Jaco
    South-Africa

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    hummm
    try converting them to string:

    if CStr(chSession) <> CStr(chString) then

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    This works:
    Code:
    
    <%@ Language=VBScript %>
    <html>
    <body>
    	
    <%
    chSession = Trim(Session("state"))
    chString = Trim(Request("sStatus"))
    
    Response.Write chSession & "<BR>"
    Response.Write chString & "<BR>"
    
    if chSession = chString then
    	
    	Response.Write "It worked<br>"
    
    Else
    	Response.Write "It didn't work"
    End If 
    %>	
    
     </BODY>
    </HTML>
    Mark
    -------------------

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2001
    Location
    Alberton, Gauteng, South-Africa
    Posts
    48

    Talking

    Thanks Guy's

    It worked out perfectly!!!! .. I combined both of your solutions!!!

    Cheers vir eers!
    ;-)
    Jaco
    South-Africa

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Okey dokey!

    The problem was your syntax in Request.Querystring("sStatus")) which was returning and empty string when I tried it.

    converting them to strings as well is probably not necsesary.
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width