WebClient Problems - Copy file text to the Hd local machine

I am trying download a file from server and copy to the Hd local machine.

I am used the WebClient but just not copy nothing and not show me any error...

My code:

           string remoteUri = "http://www.mysite/";

          string fileName = "filetext.txt", myStringWebResource = null;

          string fileNamed = "c:\\folder\\filetext.txt";

          // Create a new WebClient instance.
          WebClient myWebClient = new WebClient();

          // Concatenate the domain with the Web resource filename.
          myStringWebResource = remoteUri + fileName;

          // Download the Web resource and save it into the current filesystem folder.

What can to be happen ? 

Thank you,


Mail: rogerio.ricardo@uol.com.br


3/7/2007 7:21:25 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 50
Get it on Google Play
Get it on Apple App Store


One of your posts has been answered with the same question because of permission problem, so this one will be closed.

I even do it with your code, and there is no problem. So there is no problem with your code, but it should be your account or system permission problem. Check out that you have administrator priviledge and IIS also allow you to download.


Please give us feedback no matter whether you get your answer.
Please "mark as answer" if it's useful for you

3/13/2007 7:58:47 AM

Similar Artilces:

Creating local excel file from local text file
Hi I need to create a page that do the next task: I have a local text file, I need to read that file, make some work and create a local excel file. Any information would be appreciated! take it in steps... First, use the System.IO to read the text file. Second, do you need to create the .xls on the server or just to the client? You can use the ContentType to turn and HTML table into an Excel file, just stream it. If you need to create the xls on the SERVER thats another ballgame. You will need, I think, the Office tools and namespace to do this. Wel, I create the xls file with a HT...

ANSI text file convert to Unicode text file problem
Dear all, I got a problem from my PB 7.03 ANSI version. I need to write a program to convert a ANSI text file to Unicode text file. I had been tried to use the FromANSI, toANSI, FromUnicode and ToUnicode PB function to do that. Since those functions for convert the ANSI file to Unicode file also Unicode file to ANSI file it seem working well. However, when I try to open the Unicode file (which is convert from ANSI to Unicode format by PB function) from my Wordpad, It will show me the result was fail... So now I have a question... As I know the Unicode have different type (eg. UTF-...

Problem with System.net.webclient , getting error HTTP 404
I have a internal search on my web application.It searchs static content.For dynamic search i have used System.Net.WebClient.But it gives following error when i search any dynamic content. /************************************************************************************************/ The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. Requested URL: /web/way2k/Pages...

Problem when get data from Excel file using ADO.NET
THIS IS MY CODE Private Sub GetDataFromXLS() Dim strConn As String Dim objConn As OleDbConnection Dim sql As String strConn = _ "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:\Data.xls;" & _ "Extended Properties=Excel 8.0;HDR=Yes;" objConn = New OleDbConnection(strConn) objConn.Open() sql = "SELECT ProductCode, ProductName FROM [Data$]" '-Data is name of sheet in Data.xls. Dim objComm...

Get local machine name in MSDE setup .bat file
I have the following command in a .bat file osql -E -S localhost sp_grantlogin 'GREG\ASPNET'" What I would like to do is replace GREG with the name of the local computer this .bat file is being run on. Is there any string for this... i.e [LOCALMACHINE]\ASPNET or something like that? Greg Try... osql -E -S localhost sp_grantlogin '.\ASPNET'" -- -oj http://rac4sql.net ...

with the new beta version it became impossible to load xml files from a local directroy into a locally started html file
Name: michael schmidtner Email: mlschmid3000atgmxdotde Product: Firefox Summary: with the new beta version it became impossible to load xml files from a local directroy into a locally started html file Comments: When a locally stored html-file tries to open xml-files in the same directory by JavaScript the below exception is thrown: Access to restricted URI denied. Probably due to the fact that opening files by file:// is somehow considered as fetching them from another domain. There were similar problems (at least with the same message displayed somewhere) even with ...

Getting started with SAMBA: Problem with not being able to connect to file/folder
I have used swerdna‎'s documentation to get started with SAMBA. I am running the server on openSUSE 11.3 (switching to 12.1 here soon). On the server's machine I can access the my home directory. On a Windows 7 machine, I can get to my home directory, change directories, and then create a file. On another Linux machine, also running 11.3, I cannot access my home directory and get the message "The file or folder smb://scott/homes does not exist." Further I was not prompted for a userid/password. Any ideas? The smb.conf file is as follows: # Samba config ...

Problem in Uploading file at Remote Server -Works fine at Local Machine
Hi,   Below is the function i use to upload files at remote server........Function insertFileInRemoteServer(ByVal CompleteFTPPath As String, ByVal CompleteLocalPath As String) Try 'Create a FTP Request Object and Specfiy a Complete Path Dim reqObj As FtpWebRequest = WebRequest.Create(CompleteFTPPath) 'Call A FileUpload Method of FTP Request Object reqObj.Method = WebRequestMethods.Ftp.UploadFile ''If you want to access Resourse Protected You need to give User Name and PWDreqObj.Credentials = New NetworkCredential("xxx", "xxxxxx") ' ...

Problem with Delimited Text driver
After a driver restart allmost all files in the input directory are gone, I had appox. 5000 XML files in the input directory when the driver was restarted - only 4 of them was picked up by the driver after the restart, the rest failed with: java.io.FileNotFoundException: C:\SDIExport\Person1191259162004.xml (The system cannot find the file specified) The files are not even renamed to .bak as speciffied in the driver configuration - just gone! The problem exists in both the shipping version of the IDM 3.5 Delimited Text Driver and in the beta from document (5006360) dated 200...

Get data from a text file to an HTML file
I am trying to read data from a text file ( has a username and usercode columns) to display on an html page. It there a way to do that? The text file changes information daily. I guess it would be better to have an xml file in place of the text file, then you would apply XSLT to the XML and display them on the page as html. Regards  Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP The text file is generated from another program so I can't change the type of file.   Look at the System.IO namespace. Thare are readers in there where you pass in th...

Getting Text Between Two Words In Text File
Hi everyone, Im just wondering what the best way to do this would be.I need to get a certain line of text from a number of text file records.This text lies between "-" and a </strong> tag. How would I go about this Thanks for your help! julie Use the File class to open and read your file and then use Regular Expression to find the specific word. References: File Class Regular Expression "I refuse to sign my posts with some clever quote said by some famous tech head in order to make myself seem more intelligent"-- Bill Gates...

Text Formatting Problem in MultiLine Text And Reading from File
Hi, I am reading text and .cs files. And displaying them in a multiline TextBox. It works nice but when the file is loaded in .cs file then it all messed up and out of order. everything is too compact. anyidea how to solve itHighOnCodingWanna get high! solved. Had to use Environment.NewLine();HighOnCodingWanna get high! ...

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much appreciated.www.creativenrg.co.uk | www.therivercard.com Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

problem managing files: Getting the final file path
hi everyone, i'm trying to export the content of a gridview to an access file. My code is like: Response.Clear();Response.AddHeader("content-disposition", "Attachment;filename=" + fileName + ".MDB"); Response.Charset = "";Response.ContentType = "application/vnd.ms-access"; Response.Cache.SetCacheability(HttpCacheability.Private);Response.BufferOutput = false;Response.End();  So wheb the dialogBox is displayed, y should be able to choose where i can place the file. Is there any way to get the final path of the file after tha...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework