473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Error using TransmitFile() with asp.net 2.0 on windows xp

Hi,
I'm having a problem sending a file using TransmitFile().
The code works perfectly using WriteFile() so I'm a little confused.
Does TransmitFile() have any other prerequisites than WriteFile()?

Here's a short snippet of the code I use that doesn't work:
protected void Page_Load(object sender, EventArgs e)
{
// The context items are set in a httpmodule
Response.ContentType = (string)Context.Items["format"];
Response.TransmitFile((string)Context.Items["filename"]);
}

If I use WriteFile there instead the code works!

The error that shows up in the event log is as follows

TransmitFile failed. File Name: C:\\Inetpub\\wwwroot\\TestfileSecure.jpg


, Impersonation Enabled:
0, Token Valid: 1, HRESULT: 0x80070003
Since it works with WriteFile() I think my permissions for the file are
correct (I've set all permissions for 'Everyone' and made the IIS run
under an administrator account also to rule out any permission errors).

Thanks in advance
/Mats Lycken
Aug 1 '06 #1
3 4987
Hi Mats,

Both HttpResponse.WriteFile and HttpResponse.TransmitFile (new in 2.0)
write the contents of a file to the output stream. However, WriteFile will
load the whole file into the memory while TransmitFile won't.

There's one known issue of TransmitFile on Windows 2003 SP1:

#FIX: You cannot use the Response.TransmitFile method to transfer a file
from a Windows Server 2003 SP 1-based computer to a client computer
http://support.microsoft.com/?kbid=902780

But since you're using Windows XP, I think this might not be the cause.

I've done some test on Windows XP both using the File System mode and IIS
mode, both work correctly. I just did a simple TransmitFile which outputs a
GIF file.

I suggest you create a very simple WebSite using File System mode and just
call Response.TransmitFile(filename) and see if it works or not.

It would be great if you can create a repro project and attach it here or
send it to me.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 2 '06 #2
Hi, I created a simple website and it worked. The thing is that my other
webapplication is a little more complex. I use a httpmodule with
Context.RewritePath to create friendly url's, maybe that affects my result.

I thought that the problems with TransmitFile had gone away with 2.0.
I'm afraid I can't use TransmitFile then since we run server 2003 on our
production servers.

Walter Wang [MSFT] wrote:
Hi Mats,

Both HttpResponse.WriteFile and HttpResponse.TransmitFile (new in 2.0)
write the contents of a file to the output stream. However, WriteFile will
load the whole file into the memory while TransmitFile won't.

There's one known issue of TransmitFile on Windows 2003 SP1:

#FIX: You cannot use the Response.TransmitFile method to transfer a file
from a Windows Server 2003 SP 1-based computer to a client computer
http://support.microsoft.com/?kbid=902780

But since you're using Windows XP, I think this might not be the cause.

I've done some test on Windows XP both using the File System mode and IIS
mode, both work correctly. I just did a simple TransmitFile which outputs a
GIF file.

I suggest you create a very simple WebSite using File System mode and just
call Response.TransmitFile(filename) and see if it works or not.

It would be great if you can create a repro project and attach it here or
send it to me.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 2 '06 #3
Hi Mats,

It would be very helpful if you could create a repro project which
demostrates the issue with the HttpModule and Context.RewritePath.

For the Windows 2003 SP1 issue mentioned in the KB 902780, we have a hotfix
available upon your request.

However, although TransmitFile makes large file downloads more stable than
ever and defeats the problem of recycling, it is far from being a full
solution to the problem of tracking and resuming large file downloads. For
example, if a download fails, for whatever reason, TransmitFile can start
it again only from the beginning. The article located at the Web site
http://www.devx.com/dotnet/Article/22533 discusses a better approach to the
problem.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 3 '06 #4

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

Similar topics

5
by: Shariq Khan | last post by:
Does anyone know the C# P/Invoke declaration for the TransmitFile() api call? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/transmitfile_2.asp
0
by: Thomas Andersson | last post by:
Hi, I have a problem with Response.TransmitFile. The server reset the connection after approx. 20 minutes and sometimes after 7-8 minutes when i try to download large files (400MB +) with...
0
by: RobertP | last post by:
The issue is TransmitFile does not transmit any data or throw an exception (Although it does generate an event in the event log, see below.) Event Log: TransmitFile failed. File:...
4
by: PatB | last post by:
I am having trouble with Response.TransmitFile running on Windows 2003. I found what appeared to be a fix at http://support.microsoft.com/default.aspx?scid=kb;en-us;902780 but it just referred...
2
by: mgalvez | last post by:
I'm developing an interface that sends a file to the client. it works but the client also gets an "Action canceled" page (IE) how can I remove this page? or display the application home page? ...
1
by: APA | last post by:
I am transmitting files using response.transmitfile. I only have a problem using it with MP3s. Larger files (20MB+ ZIP files) are no problem. I'm using an HttpHandler in .NET 1.1 on Windows 2003...
0
by: elizabeth.kegel | last post by:
Hello- I have a webform with a link that needs to open an audio file *.wma. *.mp3, etc. What is odd is I am able to click on the file and the Windows Media Player opens and the audio file plays. ...
1
by: =?Utf-8?B?V29vZGdub21l?= | last post by:
Hi, I have use the following code to transmit a file back to the browser that worked fine on a HTC_TTyN device running windows mobile 5.0. The code executes in the onclick event of a mobilelist...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.