I have a web service where I need to have a third party transmit XML docs to a folder on our web server. After much pounding on permissions, I can finally path to a folder at https://sierraproductioncenter.com/Hyphen/In/Order/
however the service is throwing an error that the folder path cannot be found. If I copy and paste the path in an explorer window on web server it resolves to correct folder.
Could not find a part of the path 'C:\inetpub\vhosts\sierraproductioncenter.com\HTTPDOCS\Hyphen\In\Order\'.
I even threw directory code in just in case the directory was reading some alternative location - but no. What is wrong?
WEB SERVICE:
Imports System Imports System.IO Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <System.Web.Script.Services.ScriptService()><System.Web.Services.WebService(Namespace:="https://sierraproductioncenter.com/")><System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<ToolboxItem(False)> _ Public Class WebService1 Inherits System.Web.Services.WebService<WebMethod()> Public Function SaveDocument(ByVal docbinaryarray As Byte, ByVal docname As String) As Boolean Dim docPath As String = Server.MapPath("~\Hyphen\In\Order\") Dim strdocPath As String = Server.MapPath("~\Hyphen\In\Order\") + docname If Directory.Exists(docPath) = False Then Directory.CreateDirectory(docPath) End If Dim objfilestream As FileStream = New FileStream(strdocPath, FileMode.Create, FileAccess.ReadWrite) Dim bw As BinaryWriter = New BinaryWriter(objfilestream) bw.Write(docbinaryarray) bw.Close() objfilestream.Close() Return True End Function
WEB SERVICE CALL:
Imports System.IO Public Class DocumentService Inherits System.Web.UI.Page Dim sfile As String = Server.MapPath("~\Hyphen\In\Order\") Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Directory.Exists(sfile) = False Then Directory.CreateDirectory(sfile) End If End Sub Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objfilestream As FileStream = New FileStream(sfile, FileMode.Open, FileAccess.Read) Dim len As Integer = CType(objfilestream.Length, Integer) Dim mybytearray() As Byte = New Byte(len) {} Dim myservice As localhost.WebService1 = New localhost.WebService1() objfilestream.Read(mybytearray, 0, len) myservice.SaveDocument(mybytearray(len), sfile) objfilestream.Close() End Sub