Hello,
My question is the following:
In my current project I need to generate a server side document. This is no problem, I have completed this code.
When the exporting is done I have a physical path on the server. For example: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
Now I want to send this file back to the client so he/she sees the download dialog box.
How can this be done ?
//edit
What I have so far:
string fn = resumeBuilder.CreateDocument();
FileInfo file = new FileInfo(fn);
string fileName = file.Name;
string test = Server.MapPath(fileName);
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats";
Response.WriteFile(fileName);
Response.End();
fn gets the value: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
fileName gets the value: resume1256.docx
test gets the same value as fn
An exception is thrown with the message: could not find file: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
I guess it has something to do with that path. It probably needs to be virtual instead of physical, right ?
Thanx in advance,
Kind regards,
Spoofie
My question is the following:
In my current project I need to generate a server side document. This is no problem, I have completed this code.
When the exporting is done I have a physical path on the server. For example: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
Now I want to send this file back to the client so he/she sees the download dialog box.
How can this be done ?
//edit
What I have so far:
string fn = resumeBuilder.CreateDocument();
FileInfo file = new FileInfo(fn);
string fileName = file.Name;
string test = Server.MapPath(fileName);
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats";
Response.WriteFile(fileName);
Response.End();
fn gets the value: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
fileName gets the value: resume1256.docx
test gets the same value as fn
An exception is thrown with the message: could not find file: c:\inetpub\wwwroot\myapp\myreports\resume1256.docx
I guess it has something to do with that path. It probably needs to be virtual instead of physical, right ?
Thanx in advance,
Kind regards,
Spoofie
Last edited: