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

Posted by frankadelic on Stack Overflow See other posts from Stack Overflow or by frankadelic
Published on 2009-10-30T23:33:36Z Indexed on 2010/05/10 0:08 UTC
Read the original article Hit count: 564

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, HRESULT: 0x8007052e

The suggested alternative is to use WriteFile(), however, this is problematic because it loads the file into memory. In my application, the files are >200MB, so this is not going to scale.

Is there a method in ASP.NET for streaming files to users that's:

  • scalable (doesn't read entire file into RAM or occupy ASP.NET threads)
  • works with UNC shares

Mapping a network drive as a virtual directory is not an option for us. I would like to avoid copying the file to the local web server as well.

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about transmitfile