Also you might want to look at putting a marker such as " or ' around the
file name. If there are spaces in the filename, I don't know exactly that
would do, but I am sure it isn't going to be desired behavior.
Also it might be a setting on the broswer you are using. I had a web app
for the division I am in that worked fine, except when the site was used
outside the development group. The firm standard did not allow the filename
to be passed to the download dialog.
"Peter O'Reilly" <Peter_OReillytimeinc.com!N!O!.S!P!AM!> wrote in message
news:eU6jEOuVDHA.2052TK2MSFTNGP10.phx.gbl...the> see in line comments...
> Peter O'Reilly
> "Ian Gordon" <xisdircon.co.uk> wrote in message
> news:dyWVa.24$_M1.4533news.dircon.co.uk...> client> > Hi,
> > I have 2 problems when downloading a file from my ASP.net app to the>> > PC. At the moment I'm doing it with the following code:
> > Response.ContentType = "application/octet-stream"
> > Response.AddHeader("Content-Disposition", "attachment; filename=" +
> > strFileToDownload)
> > Response.WriteFile(strFileToDownload)
> >> > The problems are:
> > 1. How can I set the name of doent to be downloaded? At the moment,the> comes> > name of file is by default set to be the name of the web form that it>> > from, which is far from ideal. to be able to call it, for example,
> > myFile.doc.
> Code looks fine. Adding the Content-Disposition HTTP Response header iseven> solution. It could very well be a bug with that browser version. Have you
> tried requesting this file with a different browser?
> Alternatively, if in your example, myFile.doc is truly a MS Word doent,
> have you tried changing the content type to more closely match the type of
> file, i.e. application/ms-word? That may help.
>> > 2. How can I try and force the save to be in a specific directory, ormachines.> moment,> > to default to the Windows temp directory, or to My Doents? At the> > the default target directory seems quite different on differentsolution> Sorry, no dice. It's this way due to security considerations. One> >control,> would be to create your own (perhaps 'trusted') ActiveX downloader> but that would be quite a bit more work to achieve such result.