How can I create a directory on a remote server using .NET? Both servers are running Windows Server 2003. I have looked at the system.IO.directory class, and FtpWebRequest, both of which don't seem to do what I need.
If there isn't an existing method for this, I should be able to form a VPN tunnel, map the drive, and use directory.copy, right?
Update: Decided to take Rockinthesixstring's advice and create a web service on the server in which I need to create the directories. I built the following ASMX file, compiled it in visual studio, and was able to successfully invoke it from the browser page that is "automagically" generated from the ASMX file
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://ttanet.com/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
'Here is where we invoke our exposed method'
Public Sub makeDir(ByVal dirName As String)
System.IO.Directory.CreateDirectory("C:/TransferTest/" & dirName)
End Sub
End Class
Excellent suggestion -Thanks Rockin...
The second half of my question is the best way to invoke it. I need to call it from a VB.NET app. I am trying to invoke it from a browser, like:
http://localhost:60870/MakeDirectory.asmx/makeDir?dirName=testingFromURL
But it yields:
Exception Details: System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/makeDir'.
I was planning on looping through and sending WebRequestFactory.Create(urlForGetRequest) through an iteration. Is something wrong with the way my URL is structured, Is there a better way?