Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 14, 2009 07:28 PM by panand
0 Points
2 Posts
Nov 14, 2009 03:58 PM|LINK
<WebMethod()> _
Public Function WriteFile(ByVal s As String) As Boolean Dim b As Boolean = False Dim path As String Dim ioFile As System.IO.StreamWriter On Error GoTo Exception ioFile = New System.IO.StreamWriter("C:\writeFile.txt", True) ioFile.WriteLine(s) ioFile.Close() b = True GoTo Finalize Exception: b = False Debug.WriteLine("Some error occurs: [WriteFile]" & Err.Number & " : " & Err.Description) Finalize: If b = True Then Debug.WriteLine("[WriteFile]: Success[0]") End If Return b End Function
Microsoft Windows Server 2003 Enterprise Edition SP2 IIS integrated Microsoft Visual Studio 2003 Development
XML Web Services
Member
346 Points
70 Posts
Nov 14, 2009 07:28 PM|LINK
I assume that your page cannot access the file?
If so, the ASP.NET account or the IIS Worker thread process must have atleast read-only access to the physical file.
cheers
codebase
0 Points
2 Posts
Access file is denied
Nov 14, 2009 03:58 PM|LINK
<WebMethod()> _
Public Function WriteFile(ByVal s As String) As Boolean
Dim b As Boolean = False
Dim path As String
Dim ioFile As System.IO.StreamWriter
On Error GoTo Exception
ioFile = New System.IO.StreamWriter("C:\writeFile.txt", True)
ioFile.WriteLine(s)
ioFile.Close()
b = True
GoTo Finalize
Exception:
b = False
Debug.WriteLine("Some error occurs: [WriteFile]" & Err.Number & " : " & Err.Description)
Finalize:
If b = True Then
Debug.WriteLine("[WriteFile]: Success[0]")
End If
Return b
End Function
Microsoft Windows Server 2003 Enterprise Edition SP2
IIS integrated
Microsoft Visual Studio 2003 Development
XML Web Services
panand
Member
346 Points
70 Posts
Re: Access file is denied
Nov 14, 2009 07:28 PM|LINK
I assume that your page cannot access the file?
If so, the ASP.NET account or the IIS Worker thread process must have atleast read-only access to the physical file.
cheers