Solved

If

Posted on 2012-04-11
2
268 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
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 500 total points
Comment Utility
try this?

If Not objError Is Nothing Then
0
 

Author Comment

by:garethtnash
Comment Utility
Thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now