Solved

Exception at System.Web.HttpResponse.End()

Posted on 2008-10-31
3
486 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
3 Comments
 
LVL 11

Assisted Solution

by:anuragal
anuragal earned 150 total points
ID: 22848584
try calling Response.Flush after Response.Addheader then Response.write

Anurag
0
 
LVL 8

Accepted Solution

by:
dampsey earned 350 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now