Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Download a File using WebClient class

Reply
Thread Tools

Download a File using WebClient class

 
 
=?Utf-8?B?c3dlZXR5?=
Guest
Posts: n/a
 
      07-31-2007
Hi,
I'll download some file from our client site which is accessed after
logging in through some credentials. There I have the option to download a
file. I'll set it to download, and the download is started message apprears
on the page.
After a while I get an email saying that down load is complete. Then I'll go
back to the same page where I initiated download, I'll have an option to view
downloaded file.
I'll view the file and save the file on to my disk. This is the process I'm
following for a long time. In order to automate the download process I
researched some articles and have developed an asp.net web application using
WebClient.
I'm not sure why it is not working. When I run the application, it should
initiate the download process. But its not doing it.
Am I missing anything here?
This is the code I've written in the application.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.IO;

namespace FileDownload1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

WebClient Client = new WebClient();

NetworkCredential credential =
new NetworkCredential("userid", "pwd", "domain name");
Client.Credentials = credential;

Client.DownloadFile("Url", "C:\file1.xslx");


}
}
}

I'm struggling with this problem for a number of days, please any body help
me.
Thanks,

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Download a file using WebClient class sweety ASP .Net Web Controls 0 07-31-2007 06:02 PM
File uploading along with form elements using WebRequest or WebClient natzol ASP .Net 0 12-01-2006 07:15 PM
download multiple files using wildcards with WebClient.DownloadFile() Web learner ASP .Net 0 04-18-2006 10:08 PM
WebClient Class / Upload File / IIS 405 Error Grant Harmeyer ASP .Net 4 09-08-2004 11:25 AM
how to get to file in intranet using WebClient. simple ?! Vasko Peter ASP .Net Security 0 08-13-2004 03:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57