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

Error writing XML for first time on APP_DATA

Hi,
I have a issue deploying a MCMS based webapplication which is developed in
Asp.net 2.0 on the Production box, the issue is :There is a customized
configuration XML which is residing under the app_data of the application and
I have written a code for Write certain root names of that custom XML on the
Application start up on Global.asax.cs file to override certain Root Names
when the application starts up it works fine on the Development Machines but
when put on to the Production box it Shows an Error page for the first time
when the home page gets loaded and after that it works fine and the same
scenario does not brings any issue on the Development Machine, its just I am
rewriting Custom XML File on the App_Data folder, is there anything which
needs to be done on the WebServer or the Configuration ? Following is the
code I am using to Update the XML file on the App_data of the Application
written on Application_Start of global.asax.cs

System.Web.HttpContext httpContext = System.Web.HttpContext.Current;
string strFilePath =
System.Web.HttpContext.Current.Request.Application Path;
string strNewFile;
strFilePath += "/App_Data/";
strNewFile = strFilePath + "CustomWebConfig.xml";
string strReplace =
System.Configuration.ConfigurationManager.AppSetti ngs["root_channel_name"];
strReplace = "/" + strReplace + "/";

XmlDocument xmlDoc = new XmlDocument();
XmlDocument xmlDocNew = new XmlDocument();

xmlDoc.Load(httpContext.Server.MapPath(strFilePath +
"CustomWebConfigTemplate.xml"));

XmlNodeList nodeList = xmlDoc.SelectNodes("Key/Keys");

for (int i = 0; i < nodeList.Count - 1; i++)
{
nodeList[i].Attributes["Value"].Value =
nodeList[i].Attributes["Value"].Value.Replace("/{-1}/", strReplace);
}
xmlDoc.Save(httpContext.Server.MapPath(strNewFile) );

--
A fundamental rule in technology says whatever can be done will be done
Jun 27 '08 #1
0 944

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

Similar topics

2
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current...
6
by: mike | last post by:
Failed to update database "D:\INETPUB\WWWROOT\ADROUTER\APP_DATA\ADROUTER.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the current...
0
by: tony dong | last post by:
Hi there I use vs.net 2005 with standard sql 2005 under machine\sql2005 for instant when I create webpart, the code get from quickstart as follow: <%@ Page Language="C#" %> <%@ Register...
6
by: Chris Love | last post by:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not...
2
by: le0 | last post by:
guys, this is my first time to deploy website to the server, but every time i access the page this error always appears. ...
1
by: Mrozik | last post by:
Hi! I have Web Application with forms authentication. Data and security model resides in Oracle database. I have 'login' page with MS 'Login' control. In my LoggingIn event for debug purposes I...
10
by: Bart | last post by:
Hi, I get following error when trying to connect to a MDF file of sql server express 2005 database: "Microsoft OLE DB Service Components error '80040e21' Multiple-step OLE DB operation...
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
9
by: gerryR | last post by:
Hi All I've a simple web app that pulls data from an excel sheet into a small aspx page. When I browse the site through VS2005 everything works fine. When I copy the project to IIS wwwroot...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.