Solved

If

Posted on 2012-04-11
2
309 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
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…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
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…

728 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