Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Return server side file to client

Reply
Thread Tools

Return server side file to client

 
 
spoofie spoofie is offline
Junior Member
Join Date: Apr 2008
Posts: 6
 
      04-29-2008
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
 

Last edited by spoofie; 04-29-2008 at 09:13 AM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com HTML 1 01-04-2005 06:13 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Javascript 0 01-04-2005 04:06 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Java 0 01-04-2005 04:06 AM



Advertisments