Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exception at System.Web.HttpResponse.End()

Posted on 2008-10-31
3
Medium Priority
?
537 Views
Last Modified: 2012-05-05
Hi,

I've got a problem with ASP.net. Creating a text file to save plain text to users hard drive using code like below when user clicks a button.

The exception is
at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End()
The line with exception is at "Response.End()"

The text file DOES save to users hard drive successfully, its just this exception happening which I don't like.

Help appreciated, thank-you
'response to prompt user to save.
Response.ClearContent()
Response.ContentType = "text/plain"
 
Response.AddHeader("Content-disposition", "attachment;filename=""" + filename + """")
Response.Write(theText)
Response.End()

Open in new window

0
Comment
Question by:rwallacej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Assisted Solution

by:Anurag Agarwal
Anurag Agarwal earned 600 total points
ID: 22848584
try calling Response.Flush after Response.Addheader then Response.write

Anurag
0
 
LVL 8

Accepted Solution

by:
dampsey earned 1400 total points
ID: 22848948
if anuragal's solution do not work, please try the following

instead of
Respense.End()
use

Response.BufferOutput = true
Response.Flush()
Response.Close()
0
 

Author Comment

by:rwallacej
ID: 22849116
hi dampsey/anuragal,

this works now using 2nd solution. thank-you.

I have given anuragal as this started on way to getting solution

thank-you both
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question