473,320 Members | 1,922 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,320 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 6653
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: 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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.