-1

This code fails. Any help please. Thanks

using System.net
using System.IO

string uri = "https://xyzabc.com//Mats//";
FtpWebRequest reqFTP;

// Create FtpWebRequest object from the Uri provided
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
user2982029
  • 84
  • 11

2 Answers2

1

Took it from the Msdn FtpWebRequestClass information: https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(v=vs.110).aspx

This is their solution

FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri);

Their is also more information on the site about the properties and method of the FtpWebRequest class, also there are some examples of how it works.

Like rexcfnghk import isnt c# syntax, it should be using

Collin
  • 914
  • 1
  • 9
  • 30
0

This is not possible, because FtpWebRequest doesn't have a method called Create

(FtpWebRequest)FtpWebRequest.Create(new Uri(uri));

Try it with WebRequest:

(FtpWebRequest)WebRequest.Create(new Uri(uri));
Claudio P
  • 2,133
  • 3
  • 25
  • 45