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