473,395 Members | 1,578 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,395 software developers and data experts.

XML file that is read/written to disappears from server -- help wanted

My problem is with a XML file that resides on my windows 2003 web server.
I have this user control which I include on every page in my applicaiton.
The control makes it possible for the users to leave feedback when using the page.
The feedback is written to a XML file which I have put in a folder "C:/Save/".
I've set the access rights on this folder so that the "IUSR_MachineName" has full rights on this folder and it's children.

The "c:/save" folder is included as a virutal folder in the application i.e. /webApplciation/save
All this works fine. The coments are saved along with some other information from server variables.
I've tested and I can both leave a comment and read the given comments in the xml file.
The problem is when I've left the computer running for a while the XML file mysteriously disappears.

Any ideas? I wonder if this is due to some sequrity settings ont win2003 server that I'm not avare of?
I've included the control code and XML file below.

cheers,
mortb

-------------------------------------------------------------------------------------------------------------------------------

leaveComment.ascx:
<%@ Control language="c#" Codebehind="leaveComment.ascx.cs" AutoEventWireup="false" Inherits="controls.leaveComment" %>
<asp:LinkButton ID="_lnkShowComments" Runat="server">Give feedback...</asp:LinkButton>
<asp:LinkButton ID="_lnkHideComments" Runat="server" Visible="False" EnableViewState="False">Hide</asp:LinkButton>
<br>
<asp:TextBox id="_txtComments" runat="server" Height="159px" Width="421px" Visible="False" EnableViewState="False" TextMode="MultiLine"></asp:TextBox>
<br>
<asp:Button ID="_btnAddComment" Text="Submit" Runat="server" Visible="False" />
<asp:Label id="lblThx" runat="server" Visible="False"><h3>Thank you!</h3></asp:Label>

--------------------------------------------------------------------------------------------------------------------------------

leaveComment.ascx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;

namespace controls
{
public class leaveComment : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Button _btnAddComment;
protected System.Web.UI.WebControls.Label lblThx;
protected System.Web.UI.WebControls.LinkButton _lnkShowComments;
protected System.Web.UI.WebControls.LinkButton _lnkHideComments;
protected System.Web.UI.WebControls.TextBox _txtComments;
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{

InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this._lnkShowComments.Click += new System.EventHandler(this._lnkShowComments_Click);
this._lnkHideComments.Click += new System.EventHandler(this._lnkHideComments_Click);
this._btnAddComment.Click += new System.EventHandler(this._btnAddComment_Click);

}
#endregion

private void _btnAddComment_Click(object sender, System.EventArgs e)
{

XmlDocument oXml = new XmlDocument();
oXml.Load(Server.MapPath("/webApplciation/save/comments.xml"));

XmlNode oNode = oXml.SelectSingleNode("/xml/comments");
XmlElement elem = oXml.CreateElement("comment");

XmlAttribute oAttPage = oXml.CreateAttribute("page");
oAttPage.Value = Server.UrlEncode(Request.Path) ;
elem.Attributes.Append(oAttPage);

XmlAttribute oAttQString = oXml.CreateAttribute("QueryString");
oAttQString.Value = Server.UrlEncode(Request.QueryString.ToString());
elem.Attributes.Append(oAttQString);

/*
XmlAttribute oAttForm = oXml.CreateAttribute("Form");
oAttForm.Value = Request.Form.ToString();
elem.Attributes.Append(oAttForm);
*/

XmlAttribute oDate = oXml.CreateAttribute("time");
oDate.Value = Server.UrlEncode(System.DateTime.Now.ToString());
elem.Attributes.Append(oDate);

elem.InnerText = _txtComments.Text;
oNode.AppendChild(elem);

oXml.Save(Server.MapPath("/webApplciation/save/comments.xml"));

_btnAddComment.Visible = false;
_txtComments.Visible = false;

lblThx.Visible = true;

}

private void _lnkShowComments_Click(object sender, System.EventArgs e)
{
_lnkHideComments.Visible =
_txtComments.Visible =
_btnAddComment.Visible = true;

_lnkShowComments.Visible = false;
}

private void _lnkHideComments_Click(object sender, System.EventArgs e)
{
_lnkShowComments.Visible = true;

_lnkHideComments.Visible =
_txtComments.Visible =
lblThx.Visible =
_btnAddComment.Visible = false;
}
}
}

--------------------------------------------------------------------------------------------------------------------------
comments.xml:
<?xml version="1.0" encoding="utf-8"?>
<xml>
<comments>
</comments>
</xml>
Nov 18 '05 #1
0 1273

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

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
11
by: john_ramsden | last post by:
I have to prepare an Apache/PHP based (or perl if easier) web page that allows a user to upload very large files, possibly over 10 Gbytes and maybe up to 100 Gbytes. I'm aware that file upload...
2
by: Abe | last post by:
I have a strange Perl problem I don't understand. I've written the following program to scan different disks on a Windows server to look for directory files. Works fine until it gets to 'e:' when...
7
by: CG | last post by:
I am looking for a way to parse a simple log file to get the information in a format that I can use. I would like to use python, but I am just beginning to learn how to use it. I am not a...
21
by: siroregano | last post by:
Hi Everyone- I'm new to this group, and almost-as-new to asking programming questions publicly, so please forgive me if I miss a convention or two! I have a text file, around 40,000 lines...
18
by: bjorn.augestad | last post by:
We're planning to migrate our db to new and more disk drives, faster RAID levels and more dedicated disk usage(e.g. placing the translog on dedicated disks). The db server runs on Win2003. Right...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
13
by: swetha | last post by:
HI Every1, I have a problem in reading a binary file. Actually i want a C program which reads in the data from a file which is in binary format and i want to update values in it. The file...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.