Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Error writing XML for first time on APP_DATA

Reply
Thread Tools

Error writing XML for first time on APP_DATA

 
 
ankit.sri
Guest
Posts: n/a
 
      06-13-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error using Login control ASP.NET App_Data Folder aboutjav.com@gmail.com ASP .Net 4 03-12-2008 04:38 PM
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
Probelm to post XML data in a loop. First time XML is posted, second time data is getting truncated. Please help. vamsi.aluru@gmail.com Perl Misc 7 02-14-2006 12:09 PM
Any problems with writing the information into a file - Multi-users perform writing the same file at the same time ???? HNguyen ASP .Net 4 12-21-2004 01:53 PM
What XML technologies to learn first for "XML Processing" and "XML Mapping"? Bomb Diggy Java 0 07-28-2004 07:26 AM



Advertisments