Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 December 13th, 2004, 05:26 PM
Authorized User
Join Date: Jan 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rathbird
Default Writing XML file within Loop (c#)

I am trying to write xml files to the client machine in a loop. The first one saves correctly, and then the page stops processing, without errors.

My loop:

//Loop through form fields and call getaudit for every checked value
  for(int i = 0; i < Request.Form.Count;i++)
   if(Request.Form[Request.Form.AllKeys[i]] == "on")
    //this is a checkbox, parse the string for values
    string activityid = Request.Form.AllKeys[i].Substring(0,Request.Form.AllKeys[i].IndexOf("~")).ToString();
    string objectid = Request.Form.AllKeys[i].Substring(Request.Form.AllKeys[i].IndexOf("~")+1).ToString();

    //call function to write file
    SaveAudittoClient(activityid, objectid);


//Return XML for infopath to access
Response.ContentType = "text/xml";

Response.AddHeader("Content-Disposition", "attachment;filename=" + CleanFileName(CRMd.HotelName) + "_" + CRMd.Brand + "_" + DateTime.Now.ToFileTime() + ".xml");


I originally had the writing of the file in a separate aspx page, using Server.Execute, but it had the same behavior, only processing the first file in the group.

I've tested with multiple checkboxes checked, and without the function call, the method loops correctly. With the function call to write the file, the method executes correctly only on the first file.

Any suggestions? Thanks in advance for your help!

Similar Threads
Thread Thread Starter Forum Replies Last Post
writing into xml file jerryjohn XML 1 August 18th, 2006 02:40 AM
writing to am xml file MOU Classic ASP XML 0 July 6th, 2005 07:38 AM
Reading from a xml file and writing to another billy_bob_the_3rd XML 5 April 29th, 2005 01:40 PM
writing to an xml file on the client side Toran XML 2 April 2nd, 2005 03:51 PM
over writing an xml file using asp jojys XML 2 September 14th, 2004 08:38 AM

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