Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Response.End

created by yossarianc

(idea) by yossarianc (1 mon) (print)   ?   (I like it!) Mon Oct 15 2001 at 14:46:49

ASP Response Object : End Method

The End method causes the web server to stop processing the script and return the current result. The remainder of the ASP file is not processed. If Response.Buffer is set to True1, calling the End method will flush the buffer. This will send all of the output that was processed before the call of the End method to the end user.

Example:

<%
  Response.Buffer = True
  Response.Write = "Hello<br>"
  Response.End
  Response.Write = "World!"
%>
In this example, "Hello" and a "<br>" tag would be sent to the client's browser, but "World!" would not. The second Response.Write is not even processed by the ASP interpreter since it comes after the call to the End method.

Tips & Hints

Ending Performance Woes
The End method should be used to cancel the processing of scripts to which a user is no longer connected. When a user requests an ASP file, that request is placed in a queue which the ASP engine processes one at a time. If your server is heavily loaded, then this queue can become quite long, meaning that new requests (placed at the end of the queue) may have to wait to be processed for a long time. If the end user gets tired of waiting, they may hit the refresh button, the stop button, or go to another page. In each of these cases, they leave a request in the queue which no longer has a valid connection to a user.

These cases should be detected by your script (using the Response.IsClientConnected property) and removed from the queue before processing. This can be accomplished by a simple If ... Then statement at the beginning of each script.

Example (in VBScript):

<%
  Response.Buffer = True
  If NOT Response.IsClientConnected Then
    Response.End
  End If

  'Rest of your code.
%>

In this example, if the client is not connected, then the End method is called to cancel the processing of this script. In this way, you only waste time processing four lines of code instead of the entire file. On high-traffic servers, this should be required at the beginning of each ASP file.


Back to the ASP Response Object
Back to ASP Objects
1 In IIS 5.0, buffering is True by default.

Resources:
http://www.devguru.com/
http://msdn.microsoft.com/asp/

All code is my own (and still regrets its involvement with Manson to this very day).

printable version
chaos

ASP Response.Redirect Response.IsClientConnected ASP Objects
web server browser Interpreter Buffer
flush Response.Buffer Script server
response IIS VBScript Charles Manson
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Drink up!
The Satanic Verses
Humorous Writings of E2
Go
Tawana Brawley
Dreamland: a screenplay treatment
RumourQuest 2006
The best thing to happen to Atlanta since Sherman: The Whiz-Bang Chronicles
Spartacus
Saint John's wort
Millennial Prufrock
Citing writeups
Risotto
Chocolate Fondant
New Writeups
tejasa
Cranberry Cornbread(recipe)
Dreamvirus
Brighton Bombing(event)
Ariloulaleelay
'Appendices' to a 'Report' on THE HIVE×BODY MACHŸNE(log)
Timeshredder
WALL-E(review)
sitaraika
Win-laik-pya(idea)
whitelight
The abysmalists(poetry)
Hazelnut
How to solve the obesity epidemic and the oil price hike in one fell swoop(idea)
raincomplex
Spitting out teeth like ampersands(place)
wertperch
July 4, 2008(personal)
Andrew Aguecheek
Keeping In Mind(fiction)
Heitah
The Pit of Life and Death(place)
alyssa-cruz
Spitting out teeth like ampersands(person)
antigravpussy
she is his sounding board(event)
Heitah
Four day work week(idea)
Simulacron3
The Brain and Reality(essay)
This affordable entertainment brought to you by The Everything Development Company