In this Example I will show you
how to create download file and how to set download file dynamically. This file
download from server in asp.net using DirectoryInfo. So you can directly set
any file for download in you webpage for another use can download. The
DirectoryInfo class shares almost all of the same properties as the File Info
class, except that they operate on directories not files. The DirectoryInfo
class does not have static methods and can only be used on
instantiated objects. Use the DirectoryInfo class
for typical operations such as copying, moving, renaming, creating, and
deleting directories.
Step 1: Create
Webpage in your Web application.
Step 2: go to Code behind
File and in Page_Load event Code for Set File for Download in Web page.
Step 3: Now Create
another Webpage and go to Code behind and Code for Download from Server. So Use
can download attachment from you webpage.
Step 3: Now run you
First Created Webpage in Browser.
Step 4: Click on any
file for Download.
Step 5: also you can
Set Different file format for download.
Thanks for comments.....