transmitfile

getting the mime of text files

I am using a piece of code someone pasted for C# which uses urlmon.dll. It reads in <= 256bytes and returns the mime based on the data. Problem is it cant distinguishes a css file from a text/plain. I can goto /style.css but when including it in my html the CSS does not show up. I am using urlmon + context.Response.TransmitFile to send ...

Running code upon Response.TransmitFile completion

I'm using Response.TransmitFile to retrieve a file from a web service. I'd like to measure the amount of time this process takes from the server's perspective. I've tried grabbing the tick count before and after this call, but that clearly didn't represent how long the transfer took. It gave me back numbers like 0.0016 milliseconds f...

Filename and mime problems - ASP.NET Download file (C#)

I'm facing a very strange problem in my ASP.NET Application. When the user clicks the button that downloads a file, Internet Explorer / Chrome / Firefox shows the save dialog but the name of the file is the name of the ASPX Page (For example, if the page is named Download.aspx the download dialog shows the "file" Download.zip). Someti...

how to determine if file has downloaded

I have the following code that allows a user to download a file. I need to know (if possible) if they downloaded the file successfully. Is there any kind of callback that I can tie into to know whether or not they were successful in download it? Thanks. string filename = Path.GetFileName(url); context.Response.Buffer = true; context....

Response.TransmitFile() with UNC share (ASP.NET)

In the comments of this page: http://msdn.microsoft.com/en-us/library/12s31dhy.aspx ..it says that TransmitFile() cannot be used with UNC shares. As far as I can tell, this is the case; I get this error in Event Log when I attempt it: TransmitFile failed. File Name: \\myshare1\e$\file.zip, Impersonation Enabled: 0, Token Valid: 1, HRE...

Response.TransmitFile problem

I have the following code delivering a file to users when they click on a download link. For security purposes I can't just link directly to the file so this was set up to decode the url and transmit the file. It has been working fine for a while but recently I started having problems where the file will start downloading but there's n...

Why is my call to TransmitFile performing poorly compared to other methods?

First, a bit of background -- I am writing a basic FTP server for a personal project. I'm currently working on retrieving files. My current implementation looks like this: HANDLE hFile = CreateFile("file.tar.gz", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); TransmitFile(sd, hFile, fileSize, 65536, NU...

C# Response.WriteFile vs Response.TransmitFile filesize issues....

I have a 5Mb pdf on the server dowloading this file using a writeFile gives me a 15Mb download, where as the transmitfile gives the correct 5Mb filesize... Is this due to some sort of uncompression into memory on the server for the writeFile? Just wonder if anyone had seen the same thing happening... (ps only noticed it since we went t...

WriteFile vs TransmitFile for large files that need to be deleted from the server after transfer

I have to trigger user downloads of large files to a webbrowser, where I create the file to transfer on the server, then delete it immediately afterwards. I've found enough examples to see that I should probably use Response.TransmitFile or Response.WriteFile... but have heard there are problems with both: WriteFile is synchronous, but...

ASP.NET TransmitFile causes site to block

Whenever I use TransmitFile to send a file, the sirte becomes blocked to the user until the file completes. IOW, the user cannot navigate the site. If the user cancels the transfer, it still blocks until the site either times out OR finishes sending the data. I can't tell which, but I know if for example I cancel a 30MB file immediately...

ASP.NET MVC Transmitting Audio Files to Flash Player / HTTP Keep-Alive

Hi all, I have an ASP.NET MVC application that transmits audio files via a "Music" Controller and "Music" ActionResult. With this, I can serve files through our routing engine (i.e. www.mysite.com/music/stream/id=42) and do other nifty server-side stuff like logging. I also have a Flash music player (developed by a contractor) to rec...

Error in file after download.

I have word document which is opening perfectly at server but when i download it using button click event of my website it gets currept. i am using below code on button click to make document download. please help to resolve this problem: i am using .net framework 3.5 Response.Clear(); Response.AddHeader("Content-Disposition", "attac...

Downloads files from the server by visitors

Hi, I'm using clasic ASP and ASP.NET in server win2003 with IIS6. Until now visitors download files and images from my server with simple HTTP call to the file. Now I like to run ASP code before the file download and I like to know if it's will hurt my Performance. Actually I have three option: * Simple HTTP. * BinaryWrite * TransmitFi...

TransmitFile + SChannel

I'm using the TransmitFile API with I/O completion ports for an efficient multithreaded file server on Windows. This all works fine, but I've now also implemented secure sockets using SChannel. Because TransmitFile streams the file directly to the socket, I don't see a way to call EncryptMessage - will I need to read the file in chunks,...