DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 13 Aug 2007 18:15:10 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Tina
          2    nahid
          3    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
          4    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]


downloading files from filesystem   
My app needs to provide download of files (in this case .doc files) that 
exist on the file system.  I have the physical filestring i.e. 
c:\myfilesdir\smith resume.doc.
but if I load that into a navigateurl it doesn't work.  Nor does 
file://c:\myfilesdir\smith resume.doc.  Or any thing else I try.

How can I do this?

Thanks,
T
Date:Mon, 13 Aug 2007 18:15:10 -0700   Author:  

Re: downloading files from filesystem   
On Aug 14, 7:15 am, "Tina"  wrote:

> My app needs to provide download of files (in this case .doc files) that
> exist on the file system.  I have the physical filestring i.e.
> c:\myfilesdir\smith resume.doc.
> but if I load that into a navigateurl it doesn't work.  Nor does
> file://c:\myfilesdir\smith resume.doc.  Or any thing else I try.
>
> How can I do this?
>
> Thanks,
> T


hi,
try this way
                String file = Server.MapPath("~/labla/") +
"labla....";
                string fileName = "ClientFileName";

                try
                {
                    FileStream downloadFile = new FileStream(file,
FileMode.Open);

                    Response.Clear();

                    Response.ContentType = "application/octet-stream";
                    Response.AddHeader("Content-Disposition",
"attachment; filename=\"" + fileName + "\"");
                    Response.AddHeader("Content-Length",
downloadFile.Length.ToString());

                    downloadFile.Close();

                    Response.WriteFile(file);

                    Response.Flush();
                }
                catch (Exception ex)
                {
                      //...............

                }

hope help
nahid
http://nahidulkibria.blogspot.com
Date:Mon, 13 Aug 2007 21:50:08 -0700   Author:  

Re: downloading files from filesystem   
You should be able to distribute your files as desired using the techniques 
I've detailed here:
http://dotnetslackers.com/articles/aspnet/FileDenial.aspx

-- 
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"Tina"  wrote in message 
news:uxBzQCh3HHA.1204@TK2MSFTNGP03.phx.gbl...

> My app needs to provide download of files (in this case .doc files) that 
> exist on the file system.  I have the physical filestring i.e. 
> c:\myfilesdir\smith resume.doc.
> but if I load that into a navigateurl it doesn't work.  Nor does 
> file://c:\myfilesdir\smith resume.doc.  Or any thing else I try.
>
> How can I do this?
>
> Thanks,
> T
> 
Date:Tue, 14 Aug 2007 04:57:04 -0700   Author:  

Re: downloading files from filesystem   
You should be able to distribute your files as desired using the techniques 
I've detailed here:
http://dotnetslackers.com/articles/aspnet/FileDenial.aspx

-- 
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"Tina"  wrote in message 
news:uxBzQCh3HHA.1204@TK2MSFTNGP03.phx.gbl...

> My app needs to provide download of files (in this case .doc files) that 
> exist on the file system.  I have the physical filestring i.e. 
> c:\myfilesdir\smith resume.doc.
> but if I load that into a navigateurl it doesn't work.  Nor does 
> file://c:\myfilesdir\smith resume.doc.  Or any thing else I try.
>
> How can I do this?
>
> Thanks,
> T
> 
Date:Tue, 14 Aug 2007 04:58:03 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us