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
Kondratyev Denis - 18 Jun 2004 21:07 GMT
Are ASP.NET work process and IIS work process (for IIS 6.0) have read
permissions for this folder?
> Hi,
>
[quoted text clipped - 9 lines]
>
> Any thoughts???
Martin - 21 Jun 2004 08:46 GMT
It was just a permissions problem. I thought that giving sharing to
everyone would have been enough but I had to specify permission to the
ASP user.
> Are ASP.NET work process and IIS work process (for IIS 6.0) have read
> permissions for this folder?
[quoted text clipped - 12 lines]
> >
> > Any thoughts???