.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

save XML document became corrupted?

Posted By:      Posted Date: September 25, 2010    Points: 0   Category :ASP.Net

Hi all, I am experiencing a strange issue with my program: My program needs a simple data storage so I used a xml file. first, I read the data upon page opening, when user enters/modifies the form it saves the data back into the xml file.

Here is the pseudo code:

public partial class _Default : System.Web.UI.Page{
     public XmlDocument doc; //xml document
     protected void Page_Load(args)
        doc = new XmlDocument();
        /*reading data from xml doc*/
   protected void Button1_Click(args){   //When button clicks
        /*appends form data to xml doc*/


The symptom: When I am running on my local machine it runs perfectly fine, However, when I run it on my web host,  the Save process seemed to terminate before the file is finished writing. The point it stops is completely arbitrary... here is an example of corrupted xml:

<a attr="attribute 1"></a>
<a attr="attribute 2"></a>
<a attr="attribute 3"></a>
<a attr="attribute 4"></a>
<a at    <--- file terminates here, randomly, no exception thrown.

Any ideas what might have caused the problem?

View Complete Post

More Related Resource Links

how to automatically save new file into document library with a unique name or ID?

I've created a form using MS Word Document (2007) and lock it (protect it) so that users will be able to fill in the required fields.
then i've created a Content Type and uploaded the MS word form to be used as a template.

Then I've created a document library and enabled the content type and associate the above form for the library, so that when users click on New button the form will open.

everythings goes fine till here.

The problem is when users clicks on New and save the file back to the library, It doesn't save it with a unique name, instead it is over writting the existing one.
in other words, if employee 1 fill up the form and save it and later on employee 2 accessed the library and fill up a new form, he will overwrite what employee 1 has already saved!!

Is there a way to give every new created file a unique name? maybe (username+time)??

open Word document in iframe without open/ save dialouge

Hello All! In my application users upload their word document and user has been given an option to preivew the uploaded document. Inorder to  preview  the document  i put the following code in my page_load eventdiv1.InnerHtml = "<iframe name='iframe4' src='DocumentUuploaded/report.doc ' target='iframe4'  frameborder='no' height='500' scrolling='no' width='800'></iframe>";The problem is it is asking Do you want to open or save this file. How can i get rid of this dialouge box . Pls helpThanks in advance.

Can't save SQL Server Management Studio sql file back into Sharepoint Document Library

I created an sql query file in SQL Server Management Studio and saved it onto my hard drive.  I then moved that file into a Sharepoint Document Library so others on my team could use that query.I opened the file from within sharepoint, it launched SSMS.I made a change to the file and pressed save.here is the error message that comes up."The operation could not be completed.  The process cannot access the file because it is being used by another process"Am I doing something wrong?

force document 'save as' for visitor users for all documents.

hello we are using foundation as the basis for a customer extranet, one of the 'features' of sharepoint seems to be the inconsistancy of how it handles office and non-office documents. for pdf's the user is prompted for save as. For word docs if the (remote Ad authenticated )user has word this opens the document for the site and reprompts for credentials, i usderstand why this is happening as they are opening the document on different network. the question is can i force 'save as' for word and excel documents in the manner of pdfs for visitor level users. Thanks Mark  

How to save word document in sql database?

Hi all, I have created a word document in my application (.Net). How can I save the word document (containing tables and some HTML formats) in a database and retrieve it for later use? Thank you in advance,

How to enable Word 2010 to save to one of the document libraries on a newly installed Sharepoint Ser



I have a newly installed Sharepoint Server 2010 (say, http://spserver/) somewhere on our LAN on Windows Server 2008 R2. And I am working with Word 2010 on my Windows 7 machine. I have created a Document library somewhere in a subsite of the Sharepoint server (say, http://spserver/subsite/doclibrary)

Now, working with Word 2010 I want to simply save the document that I'm working into that document library Doclibrary. I go to Word 2010 backstage... and can't find anything there.

1) Save As? It only shows my file system...

2) Save & Send? I see there Save to Sharepoint. But Browse for Location button gives me nothing. If I press Save As here, I just get my file system again.

What should I configure on Sharepoint server or in my machine, so that I can save to my doclibrary with as few clicks as possible, just like I always did with my local file system.

Completing Workflow on Document Save


I have a Workflow on a document library that is triggered when a new item is added and when an item is changed. The workflow alters the title of the document to add specific metadata that would be tedious (as well as adds certain other metadata).

The workflow completes successfully if a document is opened and then closed. However, if the document is opened and then saved and then closed, the workflow shows as having been stopped, and the title isn't changed nor have any of the other fields been updated.

If the document is opened and saved, but not closed, the workflow stops as well.

Any ideas how to make the workflow complete if the document is still open?

Save generated xlsx file in document library


I have created a webpart that generates a xlsx fil with data from some lists on a sharepoint 2010 site using open xml 2.0.

So far I save the generated xlsx file on the servers harddrive just for test purpose. What I want is to save the generated xlsx file to a document library, but I feel it is a little stupid to save the file on the harddrive and afterwards upload it to the document library.

Can't I skip the "save on harddrive"-step somehow?




InfoPath 2007 Form Content Type does not save as infopath form but as xml document.


I have a couple of infopath forms deployed to sharepoint as content types. Normally, when a user creates a new document of an infopath content type, the form opens in browser mode and ,when the user fills in the form and saves the form, a new document is created in the document library with the correct icon and progid.

This was before... Now, whenever I save a form, the form submits correctly, i see the file in de document library, BUT it has the icon of an XML document, all the infopath functionality is gone and when I click the file, I get a save as dialog...

The form itself hasn't changed that much and even when I redeploy a version that worked before it still does not work. However, when I create a new doc lib and associate the malfunctioning form there, the behavior is normal and i can still reopen the saved form.


Little sidenote: I have 7 different forms that now do not work on my test machine. It used to be only one, but after redeploying them, all of them have the same problem. Now when I deployed these forms in a production environement, the same thing started happening there. So I stopped the deployment and in production there is just the newly deployed form that does not work.

I have already tried reassociating the form to the doc lib. And everything looks normal in central administration.

Any suggestions?


Default Column Values in a Document Library (SP2010) do not show up in word 2010 until you save and


when you create a document in a SP 2010 document library (of a particular content type, by clicking new, letter (content type name) in sharepoint for example) which has default values set on in in the library (set by using library settings -> change default column values), the default values do not show up until you create the document , save it and reopen it again.  Is this a bug or by design.  If it is by design, it is horrible since if some of the column default values are mandatory in the content type then you actually have to type them in before you could possibly save the file which defeats the whole point of having default column values.  Also it is tremendously clunky for a user to have to create file, save it , close it, and reopen it just to view the default metadata in the document information panel that is supposed to be there.

Anyone have any thoughts/solutions to this problem?


Not able save Documents into Document Library when connecting from Internet


Hi All,

I have created a Document Library in My portal. I am able to access, create and upload document when I am in connecting to the portal from my office (Intranet).

I am able to access the Document Library when I am connecting using Internet (external). But I am not able save Documents into Document Library. I am getting Below error Message.

"Documents in this folder are not available. The Folder May have been moved or deleted, or Network porblems may be preventing a connection to the server".

I am using Microsoft ISA as proxy server.

Please suggest me what might be wrong.


Outlook "Save as" in document library with all custom column


I want to put my Outlook 2007 email in my sharepoint document library (moss 2007).
To do that, I do "Save As" in Outlook. In "My Network Places" I put the url of my library.
Then, in some cases, my email is saved directly. And in other cases, outlook opens me the form to inform the different meta-data "web file properties" (
that's what I want) . it does not save the field values. It takes the default values of columns. Same required columns
Lire phonétiquement

However, in any case, the metadata are stored in sharepoint.

Do you use this method?
What configuration of my document library must have that outlook I am proposing to fill the metadata? (Docume

Is embedding of fonts in wpf application will save from corrupted font cache?



Recently I had corrupted font cache. I fixed it by removal of cache file and restarting of Wpf font cache service. Also I updated my outdated driver.

However there're lot's of users on customer side without administrative rights and there're no way to upgrade their pretty old drivers of videocards.


Could you say me what if i embed all fonts application use in application resources - will it help those guys to not relay on Font Cache ?

Save text box content as a text file in sharepoint 2010 document library


I am a sharepoint developer and currently I am trying to save content of a text box from client side in document library in share point 2010. I have created a sandbox solution for this. I explored the SP2010 client side object model for ECMA script, however I was not able to crack the problem.

I have created the byte array from the text box content and now I want to save it as a text file in the document library using ECMA script.

Kindly suggest how can I achieve that.

Unable to save document back to SharePoint over HTTPS.


We recently created a new SP2010 farm and upgraded and attached content databases to it from SP2007. When I try to edit any word/excel document from the SharePoint through the HTTPS i get the following pop up message box.

"\\sp.xxxx.com@SSL\DavWWWRoot\WMC\IT\Network Engineering is not accessible. You might not have permissions to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Mutual Authentication failed. The server password is out of date at the domain controller."

My name is in the Central Administration --> Manage the farm administrators group. I have Full Control permissions in the document library and almost everywhere on the site.

Download pdf document in save as dailog



 I am using following code for download pdf in save as dialog but there is problem in IE,

anyone can solve my problem

private void DownloadFile(string fname, bool forceDownload)
        string path = MapPath(fname);
        string name = Path.GetFileName(fname);
        string ext = Path.GetExtension(fname);
        string type = "";
        // set known types based on file extension  
        if (ext != null)
            switch (ext.ToLower())
                case ".htm":
                case ".html":

EditForm.aspx submit button prompts user to open/save document.


I'm not sure if anyone can help since I'm dealing with a slightly modified Edit Form and a custom work flow, but here it goes.

I am testing a SharePoint 2010 deployment which uses our 2007 production content database. Most of the database attachment process went okay, but I'm seeing something weird now on my EditForms. Whenever a user uploads a document to a particular document library, we send the user to an edit form to collect some meta data for some custom fields. As soon as you click the submit (OK) button, the form prompts you to open/save the file, as if you were trying to open it from the within the library. Once you handle that pop up, the form is then 'dead'. It doesn't redirect you as it should and the submit/cancel buttons no longer work (yet they are active).

Here's where it gets weird(er). If you try to upload a document from within the library itself, no problem. My issue only happens when you get to the upload page via a dataview of the library from a subsite (which is just a filtered dataview with a site specific filter, nothing too crazy). The link takes you to the normal OOB Upload.aspx just as if you were to get there from the document library itself, but for some reason navigating to it from the dataview (even though it takes you to the same page with the same list ID in the query string) the subsequent editform (again, same form

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend