471,330 Members | 1,251 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

pointer problems

in the following code, the Response.WriteFile errors saying "Invalid handle"

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
long xSize = email.GetAttachmentSize(xIndex);
long xOffset = 0;

GCHandle h = GCHandle.Alloc(email.GetAttachmentData(xIndex),
Response.WriteFile(h.AddrOfPinnedObject(),xOffset, xSize);

changing the type of pointer to a different type causes the error: "Handle
is not pinned"

h.AddrOfPinnedObject() = a long like: 169803832
Question: how do I get Response.WriteFile to accept the value of
h.AddrOfPinnedObject() ?

Thank you for your help.
Jun 27 '08 #1
0 707

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Thomas Baier | last post: by
21 posts views Thread by MOvetsky | last post: by
204 posts views Thread by Alexei A. Frounze | last post: by
2 posts views Thread by Mike | last post: by
13 posts views Thread by william | last post: by
19 posts views Thread by mail1779205 | last post: by
2 posts views Thread by hs.samix | last post: by
26 posts views Thread by Ioannis Vranos | last post: by

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.