|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to a
FTP server that requires a user name and password? If yes, how is the authentication information passed to the server? What was the source of your information?
http://www.dotgnu.org/pnetlib-doc/System/Net/WebRequest.html
using System; using System.Net; public class ftpWebRequest : WebRequest { //implement ftp-specific protocol methods and properties } public class ftpCreator : IWebRequestCreate { public WebRequest Create(Uri uri) { return new ftpWebRequest(); } } public class RegisterPrefixExample { public static void Main() { ftpCreator creator = new ftpCreator(); WebRequest.RegisterPrefix("ftp://", creator); WebRequest wr = WebRequest.Create("ftp://testFile"); Console.WriteLine(wr); } } Show quoteHide quote "Thom Little" wrote: > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to a > FTP server that requires a user name and password? > > If yes, how is the authentication information passed to the server? > > What was the source of your information? > > -- > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. > -- > > > > Thanks for netnoobie's input.
Hi Thom, As for the WebClient class is using the WebRequest component internally, so it can only access remote resources through the existing registred WebRequest components. For .net 1.1, there is only Http/https based or local File:// protocol based component avaliable. So we can not use the WebClient class to access remote resource through FTP protocol. Also, in .NET 2.0 there has provided FtpWebRequest and FtpWebResponse class as build-in components which can help performing FTP resource accessing. #FtpWebRequest Class http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx Thanks, Steven Cheng Microsoft Online Support Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.) -------------------- Show quoteHide quote | Thread-Topic: WebCLient microsoft.public.dotnet.framework.aspnet.webcontrols:31101| thread-index: AcXnK+cCEvfE4T5DRuSU78rr4/DguA== | X-WBNR-Posting-Host: 202.172.113.6 | From: "=?Utf-8?B?Lm5ldCBub29iaWU=?=" <netnoo***@discussions.microsoft.com> | References: <eZtd9iy5FHA.1***@TK2MSFTNGP09.phx.gbl> | Subject: RE: WebCLient | Date: Fri, 11 Nov 2005 17:53:39 -0800 | Lines: 47 | Message-ID: <4CA8A603-79E2-4779-8552-E8BEF3BB3***@microsoft.com> | MIME-Version: 1.0 | Content-Type: text/plain; | charset="Utf-8" | Content-Transfer-Encoding: 7bit | X-Newsreader: Microsoft CDO for Windows 2000 | Content-Class: urn:content-classes:message | Importance: normal | Priority: normal | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl | Xref: TK2MSFTNGXA02.phx.gbl Show quoteHide quote | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols | | http://www.dotgnu.org/pnetlib-doc/System/Net/WebRequest.html | | using System; | using System.Net; | | public class ftpWebRequest : WebRequest { | //implement ftp-specific protocol methods and properties | } | | public class ftpCreator : IWebRequestCreate | { | public WebRequest Create(Uri uri) | { | return new ftpWebRequest(); | } | } | | public class RegisterPrefixExample | { | | public static void Main() | { | | ftpCreator creator = new ftpCreator(); | WebRequest.RegisterPrefix("ftp://", creator); | WebRequest wr = WebRequest.Create("ftp://testFile"); | Console.WriteLine(wr); | } | } | | | "Thom Little" wrote: | | > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to a | > FTP server that requires a user name and password? | > | > If yes, how is the authentication information passed to the server? | > | > What was the source of your information? | > | > -- | > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. | > -- | > | > | > | > | you can use webclient in 1.1 to do FTP
there is a class on MSDN that makes a FTPWebRequest u need to use that class, or make yur own... but eaiser to use theres Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Thanks for netnoobie's input. > > Hi Thom, > > As for the WebClient class is using the WebRequest component internally, so > it can only access remote resources through the existing registred > WebRequest components. For .net 1.1, there is only Http/https based or > local File:// protocol based component avaliable. So we can not use the > WebClient class to access remote resource through FTP protocol. Also, in > .NET 2.0 there has provided FtpWebRequest and FtpWebResponse class as > build-in components which can help performing FTP resource accessing. > > #FtpWebRequest Class > http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx > > Thanks, > > Steven Cheng > Microsoft Online Support > > Get Secure! www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > -------------------- > | Thread-Topic: WebCLient > | thread-index: AcXnK+cCEvfE4T5DRuSU78rr4/DguA== > | X-WBNR-Posting-Host: 202.172.113.6 > | From: "=?Utf-8?B?Lm5ldCBub29iaWU=?=" <netnoo***@discussions.microsoft.com> > | References: <eZtd9iy5FHA.1***@TK2MSFTNGP09.phx.gbl> > | Subject: RE: WebCLient > | Date: Fri, 11 Nov 2005 17:53:39 -0800 > | Lines: 47 > | Message-ID: <4CA8A603-79E2-4779-8552-E8BEF3BB3***@microsoft.com> > | MIME-Version: 1.0 > | Content-Type: text/plain; > | charset="Utf-8" > | Content-Transfer-Encoding: 7bit > | X-Newsreader: Microsoft CDO for Windows 2000 > | Content-Class: urn:content-classes:message > | Importance: normal > | Priority: normal > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl > | Xref: TK2MSFTNGXA02.phx.gbl > microsoft.public.dotnet.framework.aspnet.webcontrols:31101 > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols > | > | http://www.dotgnu.org/pnetlib-doc/System/Net/WebRequest.html > | > | using System; > | using System.Net; > | > | public class ftpWebRequest : WebRequest { > | //implement ftp-specific protocol methods and properties > | } > | > | public class ftpCreator : IWebRequestCreate > | { > | public WebRequest Create(Uri uri) > | { > | return new ftpWebRequest(); > | } > | } > | > | public class RegisterPrefixExample > | { > | > | public static void Main() > | { > | > | ftpCreator creator = new ftpCreator(); > | WebRequest.RegisterPrefix("ftp://", creator); > | WebRequest wr = WebRequest.Create("ftp://testFile"); > | Console.WriteLine(wr); > | } > | } > | > | > | "Thom Little" wrote: > | > | > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile > to a > | > FTP server that requires a user name and password? > | > > | > If yes, how is the authentication information passed to the server? > | > > | > What was the source of your information? > | > > | > -- > | > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. > | > -- > | > > | > > | > > | > > | > > Programming Pluggable Protocols
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconProgrammingPluggableProtocols.asp
Show quoteHide quote "Steven Cheng[MSFT]" wrote: > Thanks for netnoobie's input. > > Hi Thom, > > As for the WebClient class is using the WebRequest component internally, so > it can only access remote resources through the existing registred > WebRequest components. For .net 1.1, there is only Http/https based or > local File:// protocol based component avaliable. So we can not use the > WebClient class to access remote resource through FTP protocol. Also, in > .NET 2.0 there has provided FtpWebRequest and FtpWebResponse class as > build-in components which can help performing FTP resource accessing. > > #FtpWebRequest Class > http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx > > Thanks, > > Steven Cheng > Microsoft Online Support > > Get Secure! www.microsoft.com/security > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > -------------------- > | Thread-Topic: WebCLient > | thread-index: AcXnK+cCEvfE4T5DRuSU78rr4/DguA== > | X-WBNR-Posting-Host: 202.172.113.6 > | From: "=?Utf-8?B?Lm5ldCBub29iaWU=?=" <netnoo***@discussions.microsoft.com> > | References: <eZtd9iy5FHA.1***@TK2MSFTNGP09.phx.gbl> > | Subject: RE: WebCLient > | Date: Fri, 11 Nov 2005 17:53:39 -0800 > | Lines: 47 > | Message-ID: <4CA8A603-79E2-4779-8552-E8BEF3BB3***@microsoft.com> > | MIME-Version: 1.0 > | Content-Type: text/plain; > | charset="Utf-8" > | Content-Transfer-Encoding: 7bit > | X-Newsreader: Microsoft CDO for Windows 2000 > | Content-Class: urn:content-classes:message > | Importance: normal > | Priority: normal > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > | Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250 > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl > | Xref: TK2MSFTNGXA02.phx.gbl > microsoft.public.dotnet.framework.aspnet.webcontrols:31101 > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols > | > | http://www.dotgnu.org/pnetlib-doc/System/Net/WebRequest.html > | > | using System; > | using System.Net; > | > | public class ftpWebRequest : WebRequest { > | //implement ftp-specific protocol methods and properties > | } > | > | public class ftpCreator : IWebRequestCreate > | { > | public WebRequest Create(Uri uri) > | { > | return new ftpWebRequest(); > | } > | } > | > | public class RegisterPrefixExample > | { > | > | public static void Main() > | { > | > | ftpCreator creator = new ftpCreator(); > | WebRequest.RegisterPrefix("ftp://", creator); > | WebRequest wr = WebRequest.Create("ftp://testFile"); > | Console.WriteLine(wr); > | } > | } > | > | > | "Thom Little" wrote: > | > | > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile > to a > | > FTP server that requires a user name and password? > | > > | > If yes, how is the authentication information passed to the server? > | > > | > What was the source of your information? > | > > | > -- > | > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. > | > -- > | > > | > > | > > | > > | > >
http://www.google.com.au/search?hl=en&q=msdn+ftp+webrequest&meta=
some more on google about it Show quoteHide quote "Thom Little" wrote: > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to a > FTP server that requires a user name and password? > > If yes, how is the authentication information passed to the server? > > What was the source of your information? > > -- > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. > -- > > > > an artical
http://aspalliance.com/253 ftp webrequest sample code for 1.1 http://authors.aspalliance.com/shark/articles/FtpView/FtpView.zip Show quoteHide quote "Thom Little" wrote: > Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to a > FTP server that requires a user name and password? > > If yes, how is the authentication information passed to the server? > > What was the source of your information? > > -- > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. > -- > > > > Thank you everyone.
I was in a "blind spot" and just didn't see it. It is monumentally simple. Download ... using System.Net ; WebClient wc = new WebClient( ); wc.Credentials = new NetworkCredential( "someaccount", "somepassword" ); wc.DownloadFile( "ftp://ftp.somedomain.tld/somefile.txt", @"c:\temp\somefile.txt" ); Upload ... Using System.Net ; WebClient wc = new WebClient( ); wc.Credentials = new NetworkCredential( "someaccount", "somepassword" ); wc.UploadFile( "ftp://ftp.somedomain.tld/somefile.txt", @"c:\temp\somefile.txt" ); -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. -- Show quoteHide quote".net noobie" <netnoo***@discussions.microsoft.com> wrote in message news:D8C1F01C-E36A-4044-8641-0AC9B43D3B63@microsoft.com... > an artical > http://aspalliance.com/253 > > ftp webrequest sample code for 1.1 > http://authors.aspalliance.com/shark/articles/FtpView/FtpView.zip > > > "Thom Little" wrote: > >> Is it possible to use WebClient.DownloadFile and WebClient.UploadFile to >> a >> FTP server that requires a user name and password? >> >> If yes, how is the authentication information passed to the server? >> >> What was the source of your information? >> >> -- >> -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd. >> -- >> >> >> >>
Web Server Control and property tree in design time like Font has.
Retrieve Datagrid Element Index by Name Retrieve GridView column header text on sort how to override DropDownList.SelectedValue property client-side .NET control Combining 2 Fields Using ListBox.DataTextField DropDownList LoadControl and Multiple IDs in UserControls Error DropDownList Box Newbie Listbox |
|||||||||||||||||||||||