Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 16th, 2007, 03:10 PM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enabling write permissions for NETWORK SERVICE and

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).

Code:
Imports System.IO

Partial Class TestPage
    Inherits System.Web.UI.Page

    Dim ct As String
    Dim CounterPage As String = Server.MapPath("~/counters/HitCounter.txt")

    Sub ReadFile()
        Dim objStreamReader As StreamReader
        objStreamReader = File.OpenText(CounterPage)
        ct = objStreamReader.ReadToEnd()
        ct = CLng(ct)
        ct = ct + 1
        objStreamReader.Close()
    End Sub

    Sub WriteFile()
        Dim objFileWriter As StreamWriter
        objFileWriter = File.CreateText(CounterPage)
        objFileWriter.Write(ct.ToString)
        objFileWriter.Close()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ReadFile()
        WriteFile()
        Label1.Text = ct
    End Sub

End Class
 
Old January 16th, 2007, 03:35 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The changes you make to the file on your local machine don't transfer to the hosting account. You'll need to ask your host to configure the settings for you. Some hosts have web-based access to this so you could it yourself.

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old January 17th, 2007, 10:00 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar

I did contact my host and they confirmed that the permissions are not transferred when the file is FTP'd to the host domain. They have since set the correct permissions for me.

Andy M

 
Old January 17th, 2007, 12:58 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Great. Glad it's working....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
user 'NT AUTHORITY\NETWORK SERVICE' GS ASP.NET 2.0 Basics 0 March 25th, 2007 10:58 AM
Network File Permissions Pope ASP.NET 1.0 and 1.1 Professional 2 January 12th, 2006 12:42 PM
User permissions on mapped network drive affinity Classic ASP Professional 0 January 12th, 2006 12:22 PM
Localhost Write permissions topshed Classic ASP Databases 0 July 14th, 2005 08:20 PM
Enabling all network connections with ICF nw909 VBScript 0 November 11th, 2003 03:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.