Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 15th, 2007, 02:31 AM
Authorized User
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To Download Files

 I would like to get your help to download a file from a folder in my web application.i am working with c#.net 2.0 and sql server.
 I am uploading files to a folder in my web application ,using the file-upload control.
                    waiting for your reply
Old June 15th, 2007, 02:45 AM
Friend of Wrox
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post

I am writing this code as an example which assumes that there is a folder named Upload with a notepad file testdata.txt within your webapplication.

string path = Server.MapPath("~/Upload/testdata.txt");
            FileInfo file = new FileInfo(path);

            Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
            Response.AddHeader("Content-Length", file.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.End() ;


Don't expect too much, too soon.
Old June 22nd, 2007, 12:45 AM
Authorized User
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts

Thank You Mike.
I have done it by using a hyperlink..
its working..
     Bye Take Care

Similar Threads
Thread Thread Starter Forum Replies Last Post
Download files from FTP dbellavi ASP.NET 1.0 and 1.1 Professional 7 July 19th, 2007 11:54 AM
Download files from FTP dbellavi C# 0 June 14th, 2007 02:16 AM
When will the working download files ... kmccloud BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 July 13th, 2006 11:06 AM
Size of Download Files mslane BOOK: Expert One-on-One Access Application Development 1 October 2nd, 2004 07:02 PM
Download Files sriviggu2002 PHP How-To 1 March 17th, 2004 09:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.