Reputation:
How do I convert the following line into VB.net??
FtpWebRequest uploadRequest =(FtpWebRequest)WebRequest.Create("example.com" + @"/" + "localfile.html");
Upvotes: 0
Views: 181
Reputation: 69983
Dim uploadRequest As FtpWebRequest =
DirectCast(WebRequest.Create("example.com/localfile.html"), FtpWebRequest)
For future reference, you could just put your code into a C# to VB.NET code converter.
Also I'm not sure what you're doing with website.com. Is that a string? (It's not a valid variable name if thats what its suppose to be).
Upvotes: 6
Reputation: 52523
Dim uploadRequest As FtpWebRequest =
CType(WebRequest.Create("example.com/localfile.html"), FtpWebRequest)
Upvotes: 1
Reputation: 17683
You're missing a plus sign before localfile.html:
Dim uploadRequest As FtpWebRequest = DirectCast(WebRequest.Create(website.com + "/" + "localfile.html"), FtpWebRequest)
Upvotes: 0
Reputation: 25523
Dim uploadRequest as FtpWebRequest = DirectCast(
WebRequest.Create(websitecom & "/localfile.html", FtpWebRequest)
I'm assuming websitecom is a variable and if that's the case then the "." shouldn't be in it. If it was supposed to be a string then just put it inside the quotations.
Upvotes: 0