473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Writing to a remote file

Hi

I'm fairly new to ASP.NET and am running Visual Studio 2005. I'm having a
problem implementing a guestbook page - wondered if someone could shed some
light on where I'm going wrong?

The application runs ok on my local server, but when I try running it on my
remote web hosting service I seem to have problems saving the xml file.
Here's a summary of the message I receive when I hit my submit button and
try to write back into the guestbook:

Access to the path 'C:\Inetpub\vhosts\**********\httpdocs\guestbook.x ml' is
denied

Source Error:

Line 35: // Insert data into the XML doc and save
Line 36: myXmlDocument.DocumentElement.InsertBefore(myXmlEl ement,
myXmlNode);
Line 37: myXmlDocument.Save(Server.MapPath("~/guestbook.xml"));
Line 38:
Line 39: // Re-bind data since the doc has been added to
It reads the guestbokk ok, but it looks almost like the file is read-only -
although I'm sure I didn't set it as such.
Is anyone familiar enough with the Parallels hosting service to advise me
how to ensure that the file attributes are correctly set?
Can I test the attributes from a browser?

Thanks for any help

Jeff


Oct 15 '08 #1
6 1933
On Oct 15, 9:33*pm, "Jeff" <some...@somewhere.comwrote:
Hi

I'm fairly new to ASP.NET and am running Visual Studio 2005. I'm having a
problem implementing a guestbook page - wondered if someone could shed some
light on where I'm going wrong?

The application runs ok on my local server, but when I try running it on my
remote web hosting service I seem to have problems saving the xml file.
Here's a summary of the message I receive when I hit my submit button and
try to write back into the guestbook:

Access to the path 'C:\Inetpub\vhosts\**********\httpdocs\guestbook.x ml' is
denied

Source Error:

Line 35: * * * * // Insert data into the XML doc and save
Line 36: * * * * myXmlDocument.DocumentElement.InsertBefore(myXmlEl ement,
myXmlNode);
Line 37: * * * * myXmlDocument.Save(Server.MapPath("~/guestbook.xml"));
Line 38:
Line 39: * * * * // Re-bind data since the doc has been added to

It reads the guestbokk ok, but it looks almost like the file is read-only-
although I'm sure I didn't set it as such.
Is anyone familiar enough with the Parallels hosting service to advise me
how to ensure that the file attributes are correctly set?
Can I test the attributes from a browser?

Thanks for any help

Jeff
Hi Jeff

this message means that the user account used for ASP.NET has no
rights to write in a files in that directory. The IIS Process Model on
IIS 6+ uses the NETWORK SERVICE account, and IIS 5 uses the ASPNET
account. You need to go to the control panel of your hosting service
and give write access for the required directory.

Hope this helps
Oct 15 '08 #2

"Alexey Smirnov" <al************@gmail.comwrote in message
news:cc**********************************@2g2000hs n.googlegroups.com...
Hi Jeff

this message means that the user account used for ASP.NET has no
rights to write in a files in that directory. The IIS Process Model on
IIS 6+ uses the NETWORK SERVICE account, and IIS 5 uses the ASPNET
account. You need to go to the control panel of your hosting service
and give write access for the required directory.

Hope this helps

Thanks Alexey

So, is it better to move this file to a sub-directory (say httpdocs/public)
and give write access to that rather than risk having other files within
httpdocs overwritten - or can I set permissions at the file level as well as
the directory level?

And is there any simple way to stop a mallicious user from filling up my
web-space with junk?

Thanks again
Jeff
Oct 15 '08 #3
On Oct 15, 11:58*pm, "Jeff" <some...@somewhere.comwrote:
"Alexey Smirnov" <alexey.smir...@gmail.comwrote in message

news:cc**********************************@2g2000hs n.googlegroups.com...
Hi Jeff

this message means that the user account used for ASP.NET has no
rights to write in a files in that directory. The IIS Process Model on
IIS 6+ uses the NETWORK SERVICE account, and IIS 5 uses the ASPNET
account. You need to go to the control panel of your hosting service
and give write access for the required directory.

Hope this helps

Thanks Alexey

So, is it better to move this file to a sub-directory (say httpdocs/public)
and give write access to that rather than risk having other files within
httpdocs overwritten -
If I were you I would do this option. It would be easy to control
access rights...

or can I set permissions at the file level as well as
the directory level?
Yes, you can do this. You might need to uncheck the default "inherit
from parent" flag in the Plesk and give all necessary attributes to a
single file.

And is there any simple way to stop a mallicious user from filling up my
web-space with junk?
Well the easiest way I think is CAPTCHA
http://www.google.com/search?hl=en&r...APTCHA+asp.net

Another way is to moderate the whole, or moderate all comments with
"www." and "http://"

Plus don't forget to strip off html tags

>
Thanks again
Jeff
Oct 15 '08 #4
you should be writing files to the app_data folder as writing to this
folder will not trigger a application recycle. also its protected from
users being able to download files directly. when you create the folder
be sure to give the appdomain account access.

-- bruce (sqlwork.com)

Jeff wrote:
Hi

I'm fairly new to ASP.NET and am running Visual Studio 2005. I'm having a
problem implementing a guestbook page - wondered if someone could shed some
light on where I'm going wrong?

The application runs ok on my local server, but when I try running it on my
remote web hosting service I seem to have problems saving the xml file.
Here's a summary of the message I receive when I hit my submit button and
try to write back into the guestbook:

Access to the path 'C:\Inetpub\vhosts\**********\httpdocs\guestbook.x ml' is
denied

Source Error:

Line 35: // Insert data into the XML doc and save
Line 36: myXmlDocument.DocumentElement.InsertBefore(myXmlEl ement,
myXmlNode);
Line 37: myXmlDocument.Save(Server.MapPath("~/guestbook.xml"));
Line 38:
Line 39: // Re-bind data since the doc has been added to
It reads the guestbokk ok, but it looks almost like the file is read-only -
although I'm sure I didn't set it as such.
Is anyone familiar enough with the Parallels hosting service to advise me
how to ensure that the file attributes are correctly set?
Can I test the attributes from a browser?

Thanks for any help

Jeff

Oct 16 '08 #5

"bruce barker" <no****@nospam.comwrote in message
news:Or**************@TK2MSFTNGP05.phx.gbl...
you should be writing files to the app_data folder as writing to this
folder will not trigger a application recycle. also its protected from
users being able to download files directly. when you create the folder be
sure to give the appdomain account access.

-- bruce (sqlwork.com)
Thanks bruce.

Can I just check I understand you correctly here?
Are you saying that changing a file in any directory other than App_Data may
trigger a recylce?
Does that mean a rebuild of the app's dll's ?
Just wanted to check.

Thanks
Jeff

Oct 16 '08 #6
On Oct 16, 5:59*pm, "Jeff" <some...@somewhere.comwrote:
"bruce barker" <nos...@nospam.comwrote in message

news:Or**************@TK2MSFTNGP05.phx.gbl...
you should be writing files to the app_data folder as writing to this
folder will not trigger a application recycle. also its protected from
users being able to download files directly. when you create the folderbe
sure to give the appdomain account access.
-- bruce (sqlwork.com)

Thanks bruce.

Can I just check I understand you correctly here?
Are you saying that changing a file in any directory other than App_Data may
trigger a recylce?
Does that mean a rebuild of the app's dll's ?
Just wanted to check.

Thanks
Jeff
http://petesbloggerama.blogspot.com/...plication.html
Oct 16 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

48
by: Joseph | last post by:
Hi I'm writing a commercial program which must be reliable. It has to do some basic reading and writing to and from files on the hard disk, and also to a floppy. I have foreseen a potential...
0
by: Peter A. Schott | last post by:
If I want to verify that a file has finished writing before deleting the remote file, what would be the best method? Current code on Python 2.4: #filename - remote FTP server File Name...
8
by: Lu | last post by:
Hi there, I got a program to write data to a randomly accessed file (the program moves file pointer to a certain position of the file according the current "keyword" and then writes data). It...
2
by: Mahir Karabacak | last post by:
Hi all, I need to write an server application which will work Windows Remote Desktop Server (may be Terminal server). But the difference, insted of sending whole windows desktop messages to...
4
by: Lenard Gunda | last post by:
Hello! I have created a program, that receives files, and then stores them locally for later access. This program is run on a Windows 2000 Server computer as a system service. Some of the files...
9
by: Ollie | last post by:
okay sorry for cross posting but want to see if any one can explain the solution to this problem for me: I have a .Net ASP.Net app written in C# that use COM+ components to do some business...
2
by: BLetts | last post by:
I have an ASP.NET app that must allow users to upload files. The files are stored in a virtual directory. I use Server.MapPath to map from the virtual directory name to a physical path, then the...
7
by: John Pote | last post by:
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or...
4
by: John Pote | last post by:
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.