vincentnl
Active member
I am programming a webservice. The client application needs a dataset, so the webservice needs to create and fill the dataset.
The dataset comes from en xml file. When creating a filestream in the webservice an error occurs. The file is not accessible.
System.UnauthorizedAccessException: Access to the path "C:\Inetpub\wwwroot\EetlijstWebService\eten.xml" is denied.
How can i fix it, I locate the file using c:\... for filestream does noet accept URI or URL.
Or is my IIS configured wrong?
The dataset comes from en xml file. When creating a filestream in the webservice an error occurs. The file is not accessible.
System.UnauthorizedAccessException: Access to the path "C:\Inetpub\wwwroot\EetlijstWebService\eten.xml" is denied.
Code:
Dim sPath As String
go down another level because mappath of server does not end at root
sAppPath = Me.Server.MapPath("EetlijstWebService") + "\..\"
sPath = sAppPath + sFilename
Create the FileStream to write with.
Dim myFileStream As New System.IO.FileStream(sPath, System.IO.FileMode.Create)
Create an XmlTextWriter with the fileStream.
Dim myXmlWriter As New System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode)
Write to the file with the WriteXml method.
ds.WriteXml(myXmlWriter)
myXmlWriter.Close()
How can i fix it, I locate the file using c:\... for filestream does noet accept URI or URL.
Or is my IIS configured wrong?