From: Sandra on
Hi there,

I'm uploading a file to a dedicated ".aspx" page from a "C#" console app (no
browser involved). This file needs to be converted to another format and the
resulting file then sent back (to be saved on the client's machine). I
figured out how to upload the file but can't figure out how to send the
converted file back (probably using "HttpResponse" I assume). Can anyone
help get me started:

1) Where (how) can I store a success/failure code with an appropriate error
message on failure
2) If 1) above is successful, how do I store the converted file so the
client can retrieve it
3) How does the client read both 1 and 2 above (success/failure indicator
with converted file on success or error message on failure)

I really only need the basic methods to investigate as I can probably figure
out the low-level details (I'm an experienced developer but not in ASP.NET).
Thank you.

From: Nathan Sokalski on
Here is the code I use to let users download code from my site:

Response.ClearContent()
Response.AddHeader("content-disposition", "attachment;filename=" &
CStr(e.CommandArgument))
Response.WriteFile(Server.MapPath("/sourcecode/" &
CStr(e.CommandArgument)))
Response.End()

You can obviously see what methods of the Response object I use, so you can
hopefully find the rest of the details about them in documentation for what
you need to do. The only other thing here that you may want to take note of
is that I use the content-disposition header, which you may also want to
look at the documentation for just to get the details. Hopefully this helps.
--
Nathan Sokalski
njsokalski(a)hotmail.com
http://www.nathansokalski.com/

"Sandra" <_no_spam@_no_spam.com> wrote in message
news:#tr0K0JsKHA.4220(a)TK2MSFTNGP05.phx.gbl...
> Hi there,
>
> I'm uploading a file to a dedicated ".aspx" page from a "C#" console app
> (no browser involved). This file needs to be converted to another format
> and the resulting file then sent back (to be saved on the client's
> machine). I figured out how to upload the file but can't figure out how to
> send the converted file back (probably using "HttpResponse" I assume). Can
> anyone help get me started:
>
> 1) Where (how) can I store a success/failure code with an appropriate
> error message on failure
> 2) If 1) above is successful, how do I store the converted file so the
> client can retrieve it
> 3) How does the client read both 1 and 2 above (success/failure indicator
> with converted file on success or error message on failure)
>
> I really only need the basic methods to investigate as I can probably
> figure out the low-level details (I'm an experienced developer but not in
> ASP.NET). Thank you.

From: Sandra on
> Here is the code I use to let users download code from my site:
>
> Response.ClearContent()
> Response.AddHeader("content-disposition", "attachment;filename=" &
> CStr(e.CommandArgument))
> Response.WriteFile(Server.MapPath("/sourcecode/" &
> CStr(e.CommandArgument)))
> Response.End()
>
> You can obviously see what methods of the Response object I use, so you
> can hopefully find the rest of the details about them in documentation for
> what you need to do. The only other thing here that you may want to take
> note of is that I use the content-disposition header, which you may also
> want to look at the documentation for just to get the details. Hopefully
> this helps.

That's very helpful (just ran my first successful test). Greatly
appreciated. I still need to look into header details of course, as you
mentioned. I'll do my research first but may be back with a follow-up
question if required (as a new post). Thanks again.