Solved

If

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

If Not objError Is Nothing Then
0
 

Author Comment

by:garethtnash
ID: 37832287
Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

617 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