Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

If

Posted on 2012-04-11
2
Medium Priority
?
316 Views
Last Modified: 2012-06-21
Hi Experts,

I have a script that generates an email if there was an error on the previous page, it starts --

<%
Dim objError
Set objError = Server.GetLastError()

Dim bots, foundBot
foundBot = false
bots = "Googlebot,Slurp,msnbot,bingbot,Mediapartners-Google,YandexBot"
bots = Split( bots, ",")
For i=0 To UBound(bots)
  If Instr(1, Request.ServerVariables("HTTP_USER_AGENT"), bots(i) ) Then
    foundBot = True
    Exit For
  End If
Next
If False=foundBot Then

Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")

Open in new window



But I only want the script to run
If objError <> "" ..

But If I try adding this under the declaration of the variable; --

<%
Dim objError
Set objError = Server.GetLastError()
If objError <> "" then

Open in new window


I get

""
Microsoft VBScript runtime
error '800a01b6'
Object doesn't support this property or method
/err.asp, line 5 ""

Where have i gone wrong?

Thanks
0
Comment
Question by:garethtnash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 2000 total points
ID: 37832043
try this?

If Not objError Is Nothing Then
0
 

Author Comment

by:garethtnash
ID: 37832287
Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question