Error when Request.QueryString is empty

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

Microsoft VBScript '800a000d' Runtime Error

Type mismatch: '[string: ""]'

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

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

PAGEID = Request.QueryString("PAGEID")

If PAGEID = "" or PAGEID = NULL or PAGEID = 0 Then
    PAGEID = 1
End If
+3
source share
3 answers
if IsNumeric(pageId) and pageId <> "" then
  pageId = Cint(pageId)
else
  pageId = 1
end if

this will check if the value pageIdmatters and the numerical value before accepting it.

+3
source

ASP VBScript. , PAGEID , , . , , ..

if ISNull(PAGEID) then PAGEID = 1
+1

You are in VBScript. I think you need to change this place a bit and check first

IF ISEmpty (PAGEID) THEN PAGEID = 1 End IF

You want to check that it is empty, not null. Here's an article that explains a little how Empty, Null, and Nothing work.

0
source

Source: https://habr.com/ru/post/1736496/


All Articles