Solved

Exception at System.Web.HttpResponse.End()

Posted on 2008-10-31
3
531 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 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

635 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