473,776 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error "Thread Being Aborted" while downloading file

Hi following is the code which sends file to the browser means user can
download file,
but the code generates error message Thread Being Aborted., will any
one put their thoughts

protected void SendFileToBrows er(string strpath)
{
try
{
FileInfo objFileInfo = new FileInfo(strpat h);
Response.Clear( );
Response.Conten tType = "applicatio n/octet-stream";
Response.AddHea der("Content-Disposition", "attachment ;
filename=" + objFileInfo.Nam e);
Response.AddHea der("Content-Length",
objFileInfo.Len gth.ToString()) ;
Response.WriteF ile(objFileInfo .FullName);
Response.End();
}
catch (Exception ex)
{
Response.Write( "");
}
}

Thanks
----
Hitendra Patel

Feb 15 '06 #1
4 6073
DWS
try taking out the response.write( "") out of the catch block.

"hi********@gma il.com" wrote:
Hi following is the code which sends file to the browser means user can
download file,
but the code generates error message Thread Being Aborted., will any
one put their thoughts

protected void SendFileToBrows er(string strpath)
{
try
{
FileInfo objFileInfo = new FileInfo(strpat h);
Response.Clear( );
Response.Conten tType = "applicatio n/octet-stream";
Response.AddHea der("Content-Disposition", "attachment ;
filename=" + objFileInfo.Nam e);
Response.AddHea der("Content-Length",
objFileInfo.Len gth.ToString()) ;
Response.WriteF ile(objFileInfo .FullName);
Response.End();
}
catch (Exception ex)
{
Response.Write( "");
}
}

Thanks
----
Hitendra Patel

Feb 15 '06 #2
> Hi following is the code which sends file to the browser means user can
download file,
but the code generates error message Thread Being Aborted., will any
one put their thoughts

protected void SendFileToBrows er(string strpath)
{
try
{
FileInfo objFileInfo = new FileInfo(strpat h);
Response.Clear( );
Response.Conten tType = "applicatio n/octet-stream";
Response.AddHea der("Content-Disposition", "attachment ;
filename=" + objFileInfo.Nam e);
Response.AddHea der("Content-Length",
objFileInfo.Len gth.ToString()) ;
Response.WriteF ile(objFileInfo .FullName);
Response.End();
}
catch (Exception ex)
{
Response.Write( "");
}
}

Thanks
----
Hitendra Patel


You will get a "tread aborted" exception when you do a
Response.Redire ct from within a try block. Maybe this also happens for
a Response.End.
Try moving that outside of the try/catch.

Hans Kesting
Feb 15 '06 #3
Thanks DWS

Feb 15 '06 #4
Thanks Hans Kesting

Feb 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2032
by: vincent wehren | last post by:
Hi, Trying to grasp Py_NewInterpreter()in a simple app embedding Python, I was wondering why the following gives me an error: int main() { PyThreadState *tstate; Py_Initialize();
1
6510
by: Elliot M. Rodriguez | last post by:
A few of our customers cannot access one of the pages on our vb.net asp.net site. The problems are limited to only a few people, but these people have the problem regularly. The page in question is a simple details page from a link selected from another page. The details page calls a procedure that calls our database, returns a recordset, and does some simple binding to some web controls. This page works for most of our customers. For...
3
1819
by: SKG | last post by:
I have a web page with customized datagrid and a usercontrol. Sometimes iam getting "operation aborted" internet explorer cannot find site <web page name..> when i click back button i see the page is loaded. I found my viewstate has lot of junk 3 to 4 pages. I increased temporary cache,deleted temporary files,cookies,third party installs of the ie but still problem persists. Thanks!!!
3
2947
by: Stephen Miller | last post by:
I have an ASP.Net application that sends a NetworkStream to a .Net Service, which has a TcpListener listening on a port for the ASP.Net client. When it receives a request it creates a new thread with the AddressOf a class that runs a long data intensive process that can take between 1-15 minutes and results in the creation of a uniquely named file. Meanwhile, I want my ASP.Net application to sit and wait until the file appears at a...
3
1226
by: Nice | last post by:
how to comprehend the "Thread Safety"?
5
2564
by: Aleramo | last post by:
I hope someone could say me where can i find the meaning of: gsl: sinint.c:359: ERROR: domain error Default GSL error handler invoked. Aborted or where i can find it. I don't understand the meaning. I tried to find the error but it seems inside an "if ()", and it's not a GSL instruction. The program was ok since i addicted at the function:
1
2459
by: -Lost | last post by:
This is more of a post to inform, unless of course I am missing something fundamental, in which case I would appreciate anyone explaining it. Based on Mr. Michaux's camelizeStyle function I wrote: function create_style(style) { var p = document.createElement('p'); var t = document.createTextNode('Just something to fill the P.');
1
2016
by: rmgalante | last post by:
I was wondering if anyone knows whether MS has a fix for the Menu Control. If the page is loading while you mouse over a menu control with child menus that pop out, you can generate the following error in IE. Internet Explorer cannot open the Internet site... http://www.... Operation aborted
2
1760
by: gert | last post by:
is there any way i can make setTimeout work with a private obj ? function() { var obj setTimeout("thread(obj)",0) }
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.