Stop ASP Page on Error

Discussion in 'ASP General' started by - Steve -, Jul 31, 2003.

  1. - Steve -

    - Steve - Guest

    How do you do the following?

    if(true)
    response.write "There was a problem."
    ***STOP HERE***

    more code
    more code
    more code
     
    - Steve -, Jul 31, 2003
    #1
    1. Advertising

  2. - Steve -

    Ray at Guest

    On Error Resume Next

    If Err.Number <> 0 Then
    Response.Write "There was a problem."
    '''close and kill connections/objects; other memory cleanup as necessary
    Response.End
    End If

    Ray at work

    "- Steve -" <> wrote in message
    news:...
    > How do you do the following?
    >
    > if(true)
    > response.write "There was a problem."
    > ***STOP HERE***
    >
    > more code
    > more code
    > more code
    >
    >
     
    Ray at, Jul 31, 2003
    #2
    1. Advertising

  3. - Steve -

    - Steve - Guest

    Okay perfect. I didn't have the On Error Resume Next, so it was failing
    before I could gracefully kill it.

    How do I handle this though?

    Const LDAP_ALREADY_EXISTS = &h80071392

    Set objUser = objOU.Create("User", "CN=" & strFirstName & " " & strLastName)
    objUser.Put "samAccountName", strUser
    objUser.Set

    If Err.Number = LDAP_ALREADY_EXISTS
    Then WScript.Echo "The user account already exists."
    response.end
    End If

    The If statment is never true. (It works fine in a regular VB script, but
    put it in ASP and it falls apart) If I try to create an account with the
    same username it just keeps on going, even outputing the message that the
    account was created succesfully (at the end of the script.)



    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:%...
    > On Error Resume Next
    >
    > If Err.Number <> 0 Then
    > Response.Write "There was a problem."
    > '''close and kill connections/objects; other memory cleanup as

    necessary
    > Response.End
    > End If
    >
    > Ray at work
    >
    > "- Steve -" <> wrote in message
    > news:...
    > > How do you do the following?
    > >
    > > if(true)
    > > response.write "There was a problem."
    > > ***STOP HERE***
    > >
    > > more code
    > > more code
    > > more code
    > >
    > >

    >
    >
     
    - Steve -, Jul 31, 2003
    #3
  4. - Steve -

    Ray at Guest

    I don't know if this is what you'll want, but you could simplify it and do:

    On Error Resume Next
    Set objUser = GetObject("WinNT://CompOrDomainName/TheUsersSAMname,user")
    bUserExists = IsEmpty(objUser)
    Set objUser = Nothing
    On Error Resume 0

    If bUserExists Then
    response.write "User exists."
    Else
    ''your code
    End If

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "- Steve -" <> wrote in message
    news:%...
    > Okay perfect. I didn't have the On Error Resume Next, so it was failing
    > before I could gracefully kill it.
    >
    > How do I handle this though?
    >
    > Const LDAP_ALREADY_EXISTS = &h80071392
    >
    > Set objUser = objOU.Create("User", "CN=" & strFirstName & " " &

    strLastName)
    > objUser.Put "samAccountName", strUser
    > objUser.Set
    >
    > If Err.Number = LDAP_ALREADY_EXISTS
    > Then WScript.Echo "The user account already exists."
    > response.end
    > End If
    >
    > The If statment is never true. (It works fine in a regular VB script,

    but
    > put it in ASP and it falls apart) If I try to create an account with the
    > same username it just keeps on going, even outputing the message that the
    > account was created succesfully (at the end of the script.)
    >
    >
    >
     
    Ray at, Aug 1, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Theule

    Stop Debugging doesn't stop in ASP.NET

    Matt Theule, Jul 23, 2003, in forum: ASP .Net
    Replies:
    7
    Views:
    773
    Matt Theule
    Jul 24, 2003
  2. Dan
    Replies:
    0
    Views:
    562
  3. Son KwonNam
    Replies:
    11
    Views:
    2,643
    mr_organic
    Apr 9, 2004
  4. Will
    Replies:
    1
    Views:
    15,431
    Thomas Weidenfeller
    Nov 2, 2004
  5. Angus
    Replies:
    5
    Views:
    476
    Ben Bacarisse
    Jul 18, 2010
Loading...

Share This Page