Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 Odd error: Classified check strings
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  02:53:18  Show Profile
I am trying to add extra checking to some variables in ClassPlaceAd.asp.

I am getting type mismatch error on executing this code when PortalContentID is empty
(PortalContentId = Request("PortalContentId")):
--------------------------------------------------------------------
if PortalContentId = "" or (PortalContentId > 1000) then
----------------------------------------------------------------
But there is no error when executing this code:
------------------------------------------
if PortalContentId = "" then
------------------------------------------

Any idea whats wrong here?


Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: ""]'
/mysite1/classplacead.asp, line 77

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  02:55:21  Show Profile
try CLng(PortalContentId) > 1000

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  02:59:05  Show Profile
No, its still error
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  03:01:27  Show Profile
which line is 77 exactly?

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  03:05:17  Show Profile
Its should be around line 70-80. (Should star with "if catID = "" then"
I am actually adding extra checking to this line since I am passing another variable to this page and I need to check for
empty, size and Numeric before proccessing.



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  03:10:38  Show Profile
Um ... you didn't tell me what line 77 looks like.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  03:17:49  Show Profile
The original code is: "if catID = "" then"

I added this checking:

if catID = "" or PortalContentId = "" or PortalContentID > 1000 or catID > 1000 or (Not IsNumeric(PortalContentID)) or (Not IsNumeric(catID))


I hope thats information you need

Edited by - lsakizada on 24 August 2003 03:18:47
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  03:22:35  Show Profile
did you also use CLng(catID) too? both PortalContentID and catID if they are pulled from a form are actually text values, so you have to convert them to long integer values to be able to compare against a number like 1000.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  03:29:11  Show Profile
Yes,I tried all the combinations,
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  03:33:09  Show Profile
try adding just one test at a time to determine which on is actually giving the error. you might also get an error if either of those are empty values, so you might want to do separate if statements instead of grouping them all together.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  03:37:53  Show Profile
I already did it, see the first topic.

This pass: if PortalContentId = "" then

but not this:
if PortalContentId = "" or (PortalContentId > 1000) then

or as you suggested

if PortalContentId = "" or (CLng(PortalContentId)> 1000) then

this is a nightmare.. :)
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 24 August 2003 :  03:40:13  Show Profile
so is PortalContentID actuall empty? that's probably why you are getting the other error. why don't you start with the isnumeric first (forget checking for an empty value, because it won't be numeric if it is empty)

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  03:52:26  Show Profile
No, its not working either.
its seems that this are the two cases that working
"if PortalContentId = "" then" or
"if PortalContentId = "" or CatID = "" then"

All other cases return mismatch error (including the statement with CLng(...))
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  04:03:06  Show Profile
One more case is working:
if Not IsNumeric(PortalContentID)then

but when executing this you get the error bellow

if Not IsNumeric(PortalContentID) or PortalContentID > 1000 then



Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'PortalContentId'
/mysite1/classplacead.asp, line 77

Is the any chance that I need to cast the variable ('PortalContentId) before sending it to other page?
Go to Top of Page

lsakizada
New Member

USA
90 Posts

Posted - 24 August 2003 :  04:25:06  Show Profile
Hi guys, I am happy.
here is the solution (my mistake :)

if catID = "" or catID > "1000" or PortalContentId = "" or PortaContentId > "1000" or (Not IsNumeric(PortalContentID)) or (Not IsNumeric(catID))then

Nikkol, I am realy appreciated your time and your help, regards
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.38 seconds. Powered By: Snitz Forums 2000 Version 3.4.07