Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 15th, 2007, 02:31 AM
Authorized User
Points: 270, Level: 5
Points: 270, Level: 5 Points: 270, Level: 5 Points: 270, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2006
Location: thrissur, kerala, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To Download Files

Hi
 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
                                sumith
__________________
sumith
  #2 (permalink)  
Old June 15th, 2007, 02:45 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.Clear();
            Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
            Response.AddHeader("Content-Length", file.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(file.FullName);
            Response.End() ;

Regards
Mike

Don't expect too much, too soon.
  #3 (permalink)  
Old June 22nd, 2007, 12:45 AM
Authorized User
Points: 270, Level: 5
Points: 270, Level: 5 Points: 270, Level: 5 Points: 270, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2006
Location: thrissur, kerala, India.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.