File Downloading

File Downloading

Post by Nik Kammere » Thu, 20 Feb 2003 06:39:22



I need to know how to perform file downloads from a
website application written in ASP.NET (Visual
Basic .NET).  Specifically, I want to be to have a
website visitor click a button and a file (stored on the
webserver or any other server-side location) download
would automatically take place.  I need the ability to
specify where the file is stored on the web client's
machine, and I do not want the client to be able to alter
the path location or file name.  I also need this to be
done in a secure manner (SSL).

Here is a high-level code example of what I envision:

 ..onClick_submit()

   TransferFile
("\\ServerSide\Location\File.DAT", "C:\ClientSide\LocalFil
eSystem\MyFile.TXT")

 End Sub

Thank You,
Nik Kammerer

 
 
 

File Downloading

Post by Craig Deelsnyde » Thu, 20 Feb 2003 06:50:35


This isn't really possible.  It would be a huge security risk, as you could
shove a file with a virus down to my computer whenever you wanted.  That's
why people get warnings for downloads, etc.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


> I need to know how to perform file downloads from a
> website application written in ASP.NET (Visual
> Basic .NET).  Specifically, I want to be to have a
> website visitor click a button and a file (stored on the
> webserver or any other server-side location) download
> would automatically take place.  I need the ability to
> specify where the file is stored on the web client's
> machine, and I do not want the client to be able to alter
> the path location or file name.  I also need this to be
> done in a secure manner (SSL).

> Here is a high-level code example of what I envision:

>  ..onClick_submit()

>    TransferFile
> ("\\ServerSide\Location\File.DAT", "C:\ClientSide\LocalFil
> eSystem\MyFile.TXT")

>  End Sub

> Thank You,
> Nik Kammerer



 
 
 

File Downloading

Post by Nik Kammere » Thu, 20 Feb 2003 08:48:39


I assumed that would be the response.  What if the browser
simply prompted the user to click 'OK' to download but did
not allow them to change the file name or path location?  
This has to be possible in some form because Microsoft
does it with Windows Update, etc.  Any help is greatly
appreciated.

Thanks,
Nik Kammerer

>-----Original Message-----
>This isn't really possible.  It would be a huge security
risk, as you could
>shove a file with a virus down to my computer whenever
you wanted.  That's
>why people get warnings for downloads, etc.

>--
>Craig Deelsnyder
>Microsoft MVP - ASP/ASP.NET



>> I need to know how to perform file downloads from a
>> website application written in ASP.NET (Visual
>> Basic .NET).  Specifically, I want to be to have a
>> website visitor click a button and a file (stored on the
>> webserver or any other server-side location) download
>> would automatically take place.  I need the ability to
>> specify where the file is stored on the web client's
>> machine, and I do not want the client to be able to
alter
>> the path location or file name.  I also need this to be
>> done in a secure manner (SSL).

>> Here is a high-level code example of what I envision:

>>  ..onClick_submit()

>>    TransferFile

("\\ServerSide\Location\File.DAT", "C:\ClientSide\LocalFil

- Show quoted text -

>> eSystem\MyFile.TXT")

>>  End Sub

>> Thank You,
>> Nik Kammerer

>.

 
 
 

File Downloading

Post by Craig Deelsnyde » Thu, 20 Feb 2003 13:10:34


I think that's some form of a Windows installer program that you OK to
download and run.  I haven't done this before myself, so hopefully someone
can point you in the right direction.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


> I assumed that would be the response.  What if the browser
> simply prompted the user to click 'OK' to download but did
> not allow them to change the file name or path location?
> This has to be possible in some form because Microsoft
> does it with Windows Update, etc.  Any help is greatly
> appreciated.

> Thanks,
> Nik Kammerer

> >-----Original Message-----
> >This isn't really possible.  It would be a huge security
> risk, as you could
> >shove a file with a virus down to my computer whenever
> you wanted.  That's
> >why people get warnings for downloads, etc.

> >--
> >Craig Deelsnyder
> >Microsoft MVP - ASP/ASP.NET



> >> I need to know how to perform file downloads from a
> >> website application written in ASP.NET (Visual
> >> Basic .NET).  Specifically, I want to be to have a
> >> website visitor click a button and a file (stored on the
> >> webserver or any other server-side location) download
> >> would automatically take place.  I need the ability to
> >> specify where the file is stored on the web client's
> >> machine, and I do not want the client to be able to
> alter
> >> the path location or file name.  I also need this to be
> >> done in a secure manner (SSL).

> >> Here is a high-level code example of what I envision:

> >>  ..onClick_submit()

> >>    TransferFile

> ("\\ServerSide\Location\File.DAT", "C:\ClientSide\LocalFil
> >> eSystem\MyFile.TXT")

> >>  End Sub

> >> Thank You,
> >> Nik Kammerer

> >.

 
 
 

1. File download pompt appears twice when using code to force download

I've found code on Microsoft's site to use to force the File Download prompt
to appear even if the user has their browser setup to bypass this prompt.
They have a sample file you can download that is supposed to work with .NET
at http://msdn.microsoft.com/msdnmag/issues/02/04/web/web0204.asp (link at
top, q/a around middle of page). After a bit of fixing of this sample (it
didn't work as was - I'm guessing it was for a beta version of .NET) I got
it working. However, when it prompts the user if they want to save or open
the download, they get prompted twice if they select "open".

Any ideas why?

Here is the relevant code from the download.aspx page:

-------------------------------
 Response.ContentType="application/pdf";
 Response.AddHeader( "content-disposition","attachment; filename=MER.PDF");
 strFileSize = FileSize.ToString();
Response.AddHeader("Content-Length", strFileSize);
Response.BinaryWrite(Buffer);
Response.Flush();
-------------------------------

The download.aspx file is being called via this call in another ASPX page:

-----------------------------

-----------------------------

Thanks,
Mark

2. : Re: GEnie Information SuperHighway

3. How to Force file download box when clicking on a link for a .pdf file

4. Top Model object library

5. File Download problem when creating file on the fly.

6. Email server for AS/400 & S/36

7. .aspx and .asmx files opens a file download dialog?

8. Ricoh 6200A Question

9. File download

10. ASPX file downloads instead of displays in browser

11. Asynchronous File Downloads

12. File Download in Add Web Reference

13. How to install from ISO img files downloaded