473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Stop ASP Page on Error

How do you do the following?

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

more code
more code
more code
Jul 19 '05 #1
3 12771
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 -" <se****@foundation.sdsu.edu> wrote in message
news:em**************@TK2MSFTNGP11.phx.gbl...
How do you do the following?

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

more code
more code
more code

Jul 19 '05 #2
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:%2****************@TK2MSFTNGP12.phx.gbl...
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 -" <se****@foundation.sdsu.edu> wrote in message
news:em**************@TK2MSFTNGP11.phx.gbl...
How do you do the following?

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

more code
more code
more code


Jul 19 '05 #3
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 -" <se****@foundation.sdsu.edu> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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.)

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JT | last post by:
is it possible to somehow "jump out of" an ASP page that is executed from another page via the Server.Execute method? on the page being executed i have several instances where i need to stop the...
1
by: Max | last post by:
I must stop IIS service from asp page. I think that use a vbs file that execute from asp page : asp page: <% set wshell = server.createobject("wscript.shell") wshell.run "cscript...
8
by: Matt Theule | last post by:
While stepping through an ASP.NET project, I found that data was being inserted into my database even though I was not stepping through the code that inserted the data. I have a single page with...
3
by: Lloyd Sheen | last post by:
Is there a setting in VS2003 to ensure that when debugging a page it will stop on all errors. At present it just displays a page with the error but I want it to stop at that line when the error...
2
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
2
by: Gopal Krish | last post by:
Folks, My ASPX page uses a custom user control. What happens here is that when a runtime error occurs in the ASPX page, the error is caught in the error handler and then strangely, the execution...
7
by: Timo Haberkern | last post by:
Hi there, i have some troubles with my TSearch2 Installation. I have done this installation as described in http://www.sai.msu.su/~megera/oddmuse/index.cgi/Tsearch_V2_compound_words...
7
by: jab3 | last post by:
Hello. I'm wondering if someone can answer something I'm sure has been answered a thousand times before. I am apparently just too dumb to find the answer. :) I've found information about the...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
5
by: =?Utf-8?B?SmVycnkgSg==?= | last post by:
In debug mode, I want to be able to stop on the first executed line in my aspx.vb code page without setting a specific break point. Is there a way to do that? -- Jerry J
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.