I have been trying to enable write permission for NETWORK SERVICE account to be able to write to a file. My PC has Windows XP Home edition running on it.
I have followed steps detailed in Appendix B of ASP.NET 2.0 Beginner, namely 'Windows XP Home Edition Users Only' and also in chapter 16 'Enable App Data Permissions' and even when the file and the folder it is in have read/write/execute permissions enabled for both NETWORK SERVICE and ASPNET accounts, when I upload the folder and file and run the website on my host domain I get an error that there is a security issue, and when I enable CustomErrors in the Web.Config file then I get HTTP Error 404 - File or Directory not found.
Has anyone had similar problems with these accounts and found a solution or simply can see what I'm doing wrong.
If it helps, the file contains a counter for a simple hit counter, this is updated then read whenever the page is loaded. (the code is attached below).
Partial Class TestPage
Dim ct As String
Dim CounterPage As String = Server.MapPath("~/counters/HitCounter.txt")
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(CounterPage)
ct = objStreamReader.ReadToEnd()
ct = CLng(ct)
ct = ct + 1
Dim objFileWriter As StreamWriter
objFileWriter = File.CreateText(CounterPage)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = ct