|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Parse FTP urlserver, login and password? e.g. given a ftp url like ftp://ftplogin:myp***@subdomain.domain.com I can get out the following info server = subdomain.domain.com password = mypass login = ftplogin I can successfully get the url etc by doing string parsing etc but I would like a better way which is not open to interpretation. e.g. Someone might have a @ or a : in their password then the string parsing may run into problems. TIA Markus ================================= jhgklioplsjdujehhrejhjrejhekdsdlkasdlerksdksd Hi Markus,
You want to see if the members of the Uri class can parse this for you: http://msdn2.microsoft.com/en-us/library/system.uri_members.aspx I notice UserInfo pulls out the username and password: http://msdn2.microsoft.com/en-us/library/system.uri.userinfo.aspx See also UriSchemeFtp http://msdn2.microsoft.com/en-us/library/system.uri.urischemeftp.aspx <Markus***@gmail.com> wrote in message Show quoteHide quote news:1157597487.390331.81230@i3g2000cwc.googlegroups.com... > Hi all, does anyone know how I can parse an ftp url to retrieve the > server, login and password? > > e.g. given a ftp url like > > ftp://ftplogin:myp***@subdomain.domain.com > > I can get out the following info > > server = subdomain.domain.com > password = mypass > login = ftplogin > > I can successfully get the url etc by doing string parsing etc but I > would like a better way which is not open to interpretation. > > e.g. Someone might have a @ or a : in their password then the string > parsing may run into problems. > > TIA > Markus > > ================================= > jhgklioplsjdujehhrejhjrejhekdsdlkasdlerksdksd > re:
> I notice UserInfo pulls out the username and password: Yes, UserInfo pulls them out.Then, with GetComponents, you can get the host server's name: Sub Page_Load() Dim uriAddress As New Uri("ftp://ftplogin:myp***@subdomain.domain.com/") Label1.Text = uriAddress.UserInfo Label2.Text = uriAddress.GetComponents(UriComponents.Host, UriFormat.Unescaped) End Sub See an example running at : http://asp.net.do/test/UriComponents.aspx Juan T. Llibre, asp.net MVP aspnetfaq.com : http://www.aspnetfaq.com/ asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ =================================== Show quoteHide quote "Ken Cox [Microsoft MVP]" <BANSPAMkjopc@newsgroups.nospam> wrote in message news:enaKrDj0GHA.4116@TK2MSFTNGP02.phx.gbl... > Hi Markus, > > You want to see if the members of the Uri class can parse this for you: > > http://msdn2.microsoft.com/en-us/library/system.uri_members.aspx > > I notice UserInfo pulls out the username and password: > > http://msdn2.microsoft.com/en-us/library/system.uri.userinfo.aspx > > See also > > UriSchemeFtp > > http://msdn2.microsoft.com/en-us/library/system.uri.urischemeftp.aspx > > <Markus***@gmail.com> wrote in message news:1157597487.390331.81230@i3g2000cwc.googlegroups.com... >> Hi all, does anyone know how I can parse an ftp url to retrieve the >> server, login and password? >> >> e.g. given a ftp url like >> >> ftp://ftplogin:myp***@subdomain.domain.com >> >> I can get out the following info >> >> server = subdomain.domain.com >> password = mypass >> login = ftplogin >> >> I can successfully get the url etc by doing string parsing etc but I >> would like a better way which is not open to interpretation. >> >> e.g. Someone might have a @ or a : in their password then the string >> parsing may run into problems. >> >> TIA >> Markus >> >> ================================= >> jhgklioplsjdujehhrejhjrejhekdsdlkasdlerksdksd >> > >
Other interesting topics
ASP.NET 2.0: Global.asax code-behind and web deployment project problem
Disco Not Compiling? pass dataset field to an int... Ignore SqlBulkCopy errors How to catch an error from a ASCX control VS 2003 & VS 2005 on one machine Calling aspx page from htm file Need bin directory in my web to add httpmodule Column does not belong to table error cannot get value of dropdownlist from postback |
|||||||||||||||||||||||