473,246 Members | 1,482 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,246 software developers and data experts.

Response.End() in server-side JavaScript try-catch-finally...

Hi.

Just one question: if I call Response.End() in an ASP server-side JavaScript
catch() block *and* I have a finally{} block, will the latter be skipped or will
it still be executed?

The reason is I place instructions to close an ADO connection in finally blocks
whenever I need to close a DB connection. I also have instructions that I
execute in a catch() block whenever an error occurs. These instructions clear
the Response buffer, output the error message and End() the Response stream. But
I want to make sure my connection is actually closed.

Vince C.
Jul 19 '05 #1
2 6649
Vince C. wrote:
Hi.

Just one question: if I call Response.End() in an ASP server-side
JavaScript catch() block *and* I have a finally{} block, will the
latter be skipped or will it still be executed?
No. All page activity ceases when Response.End is executed.

This is easy enough to test. Put code in your finally() block that creates a
text file or writes data to a database. The raise an error that will trigger
your catch() block and see if the action in your finally() block occurred.

The reason is I place instructions to close an ADO connection in
finally blocks whenever I need to close a DB connection. I also have
instructions that I execute in a catch() block whenever an error
occurs. These instructions clear the Response buffer, output the
error message and End() the Response stream. But I want to make sure
my connection is actually closed.

Don't use Response.End until after you close the connection

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> a écrit dans le message de
news:ew**************@tk2msftngp13.phx.gbl...
[...]
Don't use Response.End until after you close the connection


Thanks a lot, Bob. Bug fixed. As I also presume this is true with
Response.Redirect(), I've made sure my connection is closed *before*
redirecting.

Vince C.
Jul 19 '05 #3

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

Similar topics

2
by: RobertHillEDS | last post by:
While using the Soap generated ASP code, I would like to dump the raw contents of the request and response objects using Response.AppendToLog. I have tried using variations of the following code,...
1
by: S. van Beek | last post by:
Dear reader, How to increase the response in case of working with linked tables, program in frond end mdb and tables in back end mdb. For possible combinations and their response...
5
by: Paul de Goede | last post by:
I set the Response.Filter in my aspnet application but I have noticed that if you do a Server.Transfer that the filter doesn't get called. And in actual fact the response is mostly empty. It seems...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
1
by: Alex Nitulescu | last post by:
I have the following very simple colde (while learning about cookies and session state): Private Sub cmdAddCookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
1
by: emielvl | last post by:
Hello, I'm developing a client/server architecture based on the XML-RPC implementation in php4. All works pretty well, except that in the response from the server there is no "Content-Length" in...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
3
by: Jim Rojas | last post by:
I am running IIS v6.1 on a virtual hosting server. Changing the default metabase value is out of the question. Can someone tell me how I can fix this script? Thank you. <% set conn =...
9
by: RN1 | last post by:
When a server encounters the line Response.Redirect("abcd.asp") in a ASP script, the server tells the browser that it has to be redirected to another page (which is abcd.asp, in this case)....
5
by: =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?= | last post by:
I'm sorry, but I've read your code a couple of times and just don't see where the Form1 is initialized. Form1 also sounds like a class name, and this would be how you could do some form operations...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.