M
Martin
Hi,
I am writing a web service which contains a function that tries to
open up a FileStream.
When I try to do this I get the following error
"Access to the path "C:\Handheld\Images\1100314670.jpg" is denied"
I can do things like CopyFile so don't know how it can be a
permissions problem. I only seem to have a problem with FileStream.
Any thoughts???
<WebMethod(Description:="Get image")> _
Public Function GetImage(ByVal i_code As String) As
Xml.XmlDocument
Try
Dim f1 As IO.File
If Not f1.Exists("C:\Handheld\Images\1100314670.jpg") Then
Return Nothing
End If
Dim F As System.IO.FileStream = New
System.IO.FileStream("C:\Handheld\Images\1100314670.jpg",
IO.FileMode.Open)
Dim binRead As BinaryReader = New BinaryReader(F)
Dim objXml As Xml.XmlTextWriter = New
Xml.XmlTextWriter("C:\Handheld\Test.xml", System.Text.Encoding.UTF8)
objXml.WriteStartDocument()
objXml.WriteStartElement("ct", "ContactDetails",
"http://10.0.0.196/Contact")
objXml.WriteStartElement("image")
objXml.WriteAttributeString("logo", "1100314670.jpg")
Dim readByte As Integer = 0
Dim bytesToRead As Integer = 100
Dim base64Buffer(bytesToRead) As Byte
Do
readByte = binRead.Read(base64Buffer, 0, bytesToRead)
objXml.WriteBase64(base64Buffer, 0, readByte)
Loop While (bytesToRead <= readByte)
objXml.WriteEndElement()
objXml.WriteEndElement()
objXml.WriteEndDocument()
objXml.Flush()
objXml.Close()
Dim xd As Xml.XmlDocument
xd.Load("C:\Handheld\Test.xml")
Return xd
Catch ex As Exception
Return Nothing
'MsgBox("Error in SharScanService." & vbNewLine &
ex.Message)
End Try
End Function
I am writing a web service which contains a function that tries to
open up a FileStream.
When I try to do this I get the following error
"Access to the path "C:\Handheld\Images\1100314670.jpg" is denied"
I can do things like CopyFile so don't know how it can be a
permissions problem. I only seem to have a problem with FileStream.
Any thoughts???
<WebMethod(Description:="Get image")> _
Public Function GetImage(ByVal i_code As String) As
Xml.XmlDocument
Try
Dim f1 As IO.File
If Not f1.Exists("C:\Handheld\Images\1100314670.jpg") Then
Return Nothing
End If
Dim F As System.IO.FileStream = New
System.IO.FileStream("C:\Handheld\Images\1100314670.jpg",
IO.FileMode.Open)
Dim binRead As BinaryReader = New BinaryReader(F)
Dim objXml As Xml.XmlTextWriter = New
Xml.XmlTextWriter("C:\Handheld\Test.xml", System.Text.Encoding.UTF8)
objXml.WriteStartDocument()
objXml.WriteStartElement("ct", "ContactDetails",
"http://10.0.0.196/Contact")
objXml.WriteStartElement("image")
objXml.WriteAttributeString("logo", "1100314670.jpg")
Dim readByte As Integer = 0
Dim bytesToRead As Integer = 100
Dim base64Buffer(bytesToRead) As Byte
Do
readByte = binRead.Read(base64Buffer, 0, bytesToRead)
objXml.WriteBase64(base64Buffer, 0, readByte)
Loop While (bytesToRead <= readByte)
objXml.WriteEndElement()
objXml.WriteEndElement()
objXml.WriteEndDocument()
objXml.Flush()
objXml.Close()
Dim xd As Xml.XmlDocument
xd.Load("C:\Handheld\Test.xml")
Return xd
Catch ex As Exception
Return Nothing
'MsgBox("Error in SharScanService." & vbNewLine &
ex.Message)
End Try
End Function