|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Uri Class broken for authenticated URIs?the FtpWebClient class which takes a URI. Problem is, the URI doesn't seem to accept standard ftp://username:password@server/ URIs and gives me the following error when I try to get the propery serverUri.uri from below: {"Invalid URI: A port was expected because of there is a colon (':') present but the port could not be parsed."} System.FormatException {System.UriFormatException} Does anybody know what's going on? UriBuilder serverUri = new UriBuilder(); serverUri.Scheme = Uri.UriSchemeFtp; serverUri.Host = "servername.com"; serverUri.UserName = "username"; serverUri.Password = "password"; Thanks, Leonard why dont you provide port as well ........
Show quote "Leonard Chung" <Leonard Ch***@discussions.microsoft.com> wrote in message news:67416D68-EB9F-4E2B-BFC9-7A0E1AD1216C@microsoft.com... > I'm trying to create an authenticated session to a remote FTP server using > the FtpWebClient class which takes a URI. Problem is, the URI doesn't seem > to > accept standard ftp://username:password@server/ URIs and gives me the > following error when I try to get the propery serverUri.uri from below: > > {"Invalid URI: A port was expected because of there is a colon (':') > present > but the port could not be parsed."} System.FormatException > {System.UriFormatException} > > Does anybody know what's going on? > > UriBuilder serverUri = new UriBuilder(); > serverUri.Scheme = Uri.UriSchemeFtp; > serverUri.Host = "servername.com"; > serverUri.UserName = "username"; > serverUri.Password = "password"; > > Thanks, > > Leonard This happens with a port specified as well...
Show quote "Mubashir Khan" wrote: > why dont you provide port as well ........ > > "Leonard Chung" <Leonard Ch***@discussions.microsoft.com> wrote in message > news:67416D68-EB9F-4E2B-BFC9-7A0E1AD1216C@microsoft.com... > > I'm trying to create an authenticated session to a remote FTP server using > > the FtpWebClient class which takes a URI. Problem is, the URI doesn't seem > > to > > accept standard ftp://username:password@server/ URIs and gives me the > > following error when I try to get the propery serverUri.uri from below: > > > > {"Invalid URI: A port was expected because of there is a colon (':') > > present > > but the port could not be parsed."} System.FormatException > > {System.UriFormatException} > > > > Does anybody know what's going on? > > > > UriBuilder serverUri = new UriBuilder(); > > serverUri.Scheme = Uri.UriSchemeFtp; > > serverUri.Host = "servername.com"; > > serverUri.UserName = "username"; > > serverUri.Password = "password"; > > > > Thanks, > > > > Leonard > > > Hello, Leonard!
Stange, I can't reproduce that exception, the code I used UriBuilder urlB = new UriBuilder(); urlB.Scheme = Uri.UriSchemeFtp; urlB.Host = "servername.com"; urlB.UserName = "username"; urlB.Password = "password"; the result is urlB.Uri.ToString() -> "ftp://username:passw***@servername.com/" LC> I'm trying to create an authenticated session to a remote FTP server LC> using LC> the FtpWebClient class which takes a URI. Problem is, the URI LC> doesn't seem to LC> accept standard ftp://username:password@server/ URIs and gives me LC> the LC> following error when I try to get the propery serverUri.uri from LC> below: LC> {"Invalid URI: A port was expected because of there is a colon (':') LC> present LC> but the port could not be parsed."} System.FormatException LC> {System.UriFormatException} LC> Does anybody know what's going on? LC> UriBuilder serverUri = new UriBuilder(); LC> serverUri.Scheme = Uri.UriSchemeFtp; LC> serverUri.Host = "servername.com"; LC> serverUri.UserName = "username"; LC> serverUri.Password = "password"; LC> Thanks, LC> Leonard Strange! I'm using VC# Express if that helps.
Show quote "Vadym Stetsyak" wrote: > Hello, Leonard! > > Stange, I can't reproduce that exception, the code I used > UriBuilder urlB = new UriBuilder(); > urlB.Scheme = Uri.UriSchemeFtp; > urlB.Host = "servername.com"; > urlB.UserName = "username"; > urlB.Password = "password"; > > the result is > urlB.Uri.ToString() -> "ftp://username:passw***@servername.com/" > > LC> I'm trying to create an authenticated session to a remote FTP server > LC> using > LC> the FtpWebClient class which takes a URI. Problem is, the URI > LC> doesn't seem to > LC> accept standard ftp://username:password@server/ URIs and gives me > LC> the > LC> following error when I try to get the propery serverUri.uri from > LC> below: > > LC> {"Invalid URI: A port was expected because of there is a colon (':') > LC> present > LC> but the port could not be parsed."} System.FormatException > LC> {System.UriFormatException} > > LC> Does anybody know what's going on? > > LC> UriBuilder serverUri = new UriBuilder(); > LC> serverUri.Scheme = Uri.UriSchemeFtp; > LC> serverUri.Host = "servername.com"; > LC> serverUri.UserName = "username"; > LC> serverUri.Password = "password"; > > LC> Thanks, > > LC> Leonard > > -- > Regards, Vadym Stetsyak > www: http://vadmyst.blogspot |
|||||||||||||||||||||||