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: Tue, 31 Jul 2007 11:02:11 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    sweety


Download a file using WebClient class   
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,
Date:Tue, 31 Jul 2007 11:02:11 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


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