K
Kevin Steffer
Hi Group
My FTP problem again.
I have a FTP class that can connect to a server with username and
password and so on.
I want to make this class available for a WebRequest like
HttpWebRequest i now wanne make a FtpWebRequest class. To do what I
need to make an Interface for my ftp class:
public class ftp : IWebRequestCreate
{
public string FtpCmd(string cmd)
{
string reply = "";
// my ftp connection and executing stuff
return reply;
}
public WebRequest Create(Uri uri)
{
return null; // It says by default
}
}
I know I must return a WebRequest from the Create method but it's a
FTP request which is not shipped with the Framework. So I have to
Register my own Prefix but what method and what would that look like ?
----------------------------------
This ?
----------------------------------
public WebRequest Create(Uri uri)
{
if (WebRequest.RegisterPrefix("ftp",this.ftp))
{
WebRequest wreq = new
WebRequest.Create("ftp://me:xxx@localhost");
}
else
{
return null;
}
}
Any help is appreciated I was lost reading the docs on
IWebRequestCreate
/- Kevin -\
My FTP problem again.
I have a FTP class that can connect to a server with username and
password and so on.
I want to make this class available for a WebRequest like
HttpWebRequest i now wanne make a FtpWebRequest class. To do what I
need to make an Interface for my ftp class:
public class ftp : IWebRequestCreate
{
public string FtpCmd(string cmd)
{
string reply = "";
// my ftp connection and executing stuff
return reply;
}
public WebRequest Create(Uri uri)
{
return null; // It says by default
}
}
I know I must return a WebRequest from the Create method but it's a
FTP request which is not shipped with the Framework. So I have to
Register my own Prefix but what method and what would that look like ?
----------------------------------
This ?
----------------------------------
public WebRequest Create(Uri uri)
{
if (WebRequest.RegisterPrefix("ftp",this.ftp))
{
WebRequest wreq = new
WebRequest.Create("ftp://me:xxx@localhost");
}
else
{
return null;
}
}
Any help is appreciated I was lost reading the docs on
IWebRequestCreate
/- Kevin -\