Solved

If

Posted on 2012-04-11
2
279 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
ID: 37832043
try this?

If Not objError Is Nothing Then
0
 

Author Comment

by:garethtnash
ID: 37832287
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
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 …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

932 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

16 Experts available now in Live!

Get 1:1 Help Now