Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when Request.QueryString is empty

Tags:

asp-classic

Sometimes users mistakenly redirected to ?Process=ViewImages&PAGEID=. When this happens, they get the following error.

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: ""]'

/FLPM/cp/images.cs.asp, line 91

I tried to fix it with the following codes but still get the same error.

PAGEID = Request.QueryString("PAGEID")

If PAGEID = "" or PAGEID = NULL or PAGEID = 0 Then
    PAGEID = 1
End If
like image 630
zurna Avatar asked May 22 '26 21:05

zurna


2 Answers

if IsNumeric(pageId) and pageId <> "" then
  pageId = Cint(pageId)
else
  pageId = 1
end if

this will check if the pageId has a value and is a numeric value, before accepting it..

like image 54
Gabriele Petrioli Avatar answered May 26 '26 18:05

Gabriele Petrioli


Classic ASP uses VBScript. So your PAGEID is dynamically cast, and since it is empty you cannot compare it to a string. You will also get an error if you try and compare the length, substr and so on.

if ISNull(PAGEID) then PAGEID = 1
like image 22
Lloyd Avatar answered May 26 '26 20:05

Lloyd