The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Response.End in ASP.NET and HTTP Handlers

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
Response.End in ASP.NET and HTTP Handlers Posted: Dec 3, 2003 6:22 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: Response.End in ASP.NET and HTTP Handlers
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

I'm currently sitting through the ASP.NET Exposed Roadshow here in Denver and I just saw something on the screen that caught my eye.

Rob Howard had an ASPX page that was pulling documents out of a database. After putting the content out and writing it back to the Response.OutputStream, he called Response.End. Now this was a nice demo of using File upload into and out of a database, but like so many MS demos, it could easily mislead novices.

Now I seem to recall someone writing somewhere that Response.End (and Response.Redirect for that matter) actually do some very nasty things deep down inside of the .NET runtime. From what I recall, they both cause some pretty nasty stuff to occur deep down inside of .NET (exceptions... forceably terminated threads... etc.)

The right answer of course, is to use an HTTP Handler (ASHX) file. ASHX files let you create an HTTP endpoint that can return any content type that you want.

Later on, Ron demoed how to create an image on the fly using ASP.NET. Once again he used an ASPX file instead of an ASHX file. I understand that introducing ASHX files to a group of potential newbies is risky, but I'm really getting tired of running into "experienced" .NET developers who copy the things they see in these demos and put it in production code.

Read: Response.End in ASP.NET and HTTP Handlers

Topic: Popup control Previous Topic   Next Topic Topic: Tech Rich Guy Give It Back

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use