Groups | Blog | Home
all groups > inetserver asp general > august 2003 >

inetserver asp general : Response.Status


Kevin Jackson
8/21/2003 7:42:59 AM
If I have something like this...

if Count > 0
Response.Status = "400"
else
Response.Status = "200"
end if

The status is always set to 400 even if count is zero...

Am I missing something?

Thanks

Lin Ma
8/21/2003 9:24:19 AM
I think you really want is this:

<%
count = 0

if count > 0 then
count = "400"
else
count = "200"
end if


response.write count 'display the result
%>

there is no Response.Status method.

Lin Ma



[quoted text, click to view]

Kevin Jackson
8/21/2003 10:07:20 AM
I believe if you look at the methods for Response you will see there IS a
Response.Status method

[quoted text, click to view]

Aaron Bertrand - MVP
8/21/2003 11:03:48 AM
[quoted text, click to view]

That is correct. However, there is a response.status *property* in IIS 5.0
and above.

http://msdn.microsoft.com/library/en-us/iisref/htm/ref_vbom_reso.asp
http://msdn.microsoft.com/library/en-us/iisref/htm/ref_vbom_resopstatus.asp

You should read the docs before stating "facts"...

Copa
8/21/2003 2:23:13 PM
For some reason the script engine may be looking at Count as a Text string
instead of a number. I just ran into this again today, to fix it i
converted both numbers to Longs while comparing them and this fixed the
problem, I am pretty sure if you do the same it will work properly.

And Response.Status will work just fine!

if cLng(Count) > clng(0)
Response.Status = "400"
else
Response.Status = "200"
end if


[quoted text, click to view]

lukezhan NO[at]SPAM online.microsoft.com
8/22/2003 3:29:21 AM
Here is the complete code I tested, it seems to work:

Count=3

'Count=0

if cLng(Count) > clng(0) then
Response.Status = "400"
else
Response.Status = "200"
end if

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/security_bulletins/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."
AddThis Social Bookmark Button