.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

NullReference Exception when editing an xml file in C#

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Windows Application
When trying to add new node to Category node, I get categoryNode is null, but it exists in xml file CODE: XmlDocument     xmlDoc = new XmlDocument(); xmlDoc.Load(requestPath);     XmlNode categoryNode = xmlDoc.SelectSingleNode("CATEGORY");     XmlNode newNode = xmlDoc.CreateElement("REQUEST");     XmlAttribute newAttribute = xmlDoc.CreateAttribute("description"); newAttribute.Value = request.GetId(); newNode.InnerText =   "blank"; newNode.Attributes.Append(newAttribute); categoryNode.AppendChild(newNode); xmlDoc.Save(requestPath);   FILE: <GROUP description="Kwang">   <CATEGORY description="soo">blank</CATEGORY>   </GROUP>

View Complete Post

More Related Resource Links

spfile.delete gives file is checked out or locked for editing exception.


hello friends,

i have developed a custom webservice wherein i try to move the spfile within a document library between two folders. I tried with spfile.delete but it gives me exception.

System.Runtime.InteropServices.COMException (0x8107090E): The file is a user http://tsnt4-test/espis/Lists/TSAkJKDocuments/154545445-342423/abc.doc DMTSIT \ spospisilova checked out or locked for editing.

even when i try to use spfile.copyTo and spfile.moveTo it gives me the same exception

i used the following two approaches

  //Approach 1

How to change the split view when editing an aspx file

I've been using SPD 2010 more and more over the past few weeks.  However, when there's a navigation bar on the left, toolbox on the right, ribbon above and split view of code and design in the middle, there's just not enough room on the screen - (I have 2 LCDs at 1280x1024).  I can spread the window accross both monitors but that's not much use unless, I can change the split between code and design from horizontal to vertical. Is this possible?  Help apprieciated. Cheers, Bill

File Not Found Exception from iiscore.dll

Create a asp.net mvc project with the default template  and used bmc appsight to monitor the w3wp process ; so when ever an action is clicked an exception is occured in iiscore.dll here is the sample one which i got.  Log Entry 530641OperationOpen "\\?\C:\CRAPPYTEST\HOME\ABOUT"CommentThe system cannot find the path specified. ProcessW3WP.exe:5436:5844Causality ID: {0B49C343-7918-4721-A53E-FFD4C7A1C35D}Moduleiiscore.dllTimeStart - Sep 14 18:39:43.913035Duration - 0.000121Stack Dumpiiscore.dll, 0x5d65fddciiscore.dll, 0x5d64b7b3iiscore.dll, 0x5d64fe97iiscore.dll, 0x5d65270fiiscore.dll, 0x5d6562dfiiscore.dll, 0x5d656338iiscore.dll, 0x5d65084eWEBENGINE.DLL, 0x5c8c289bWEBENGINE.DLL, 0x5c8c28d0System.Web.ni.dll, 0x1e7cdd3dSystem.Web.ni.dll, 0x1e7cdb80mscorwks.dll, 0x71761e6fmscorwks.dll, 0x719ba26emscorwks.dll, 0x718bdf6fmscorwks.dll, 0x719ba3a9mscorwks.dll, 0x718bef35mscorwks.dll, 0x719ba42dWEBENGINE.DLL, 0x5c8c7a2eWEBENGINE.DLL, 0x5c8c34cfmscorwks.dll, 0x718bea90mscorwks.dll, 0x718be3a2mscorwks.dll, 0x718be516mscorwks.dll, 0x718a1ec9kernel32.dll, 0x76881194ntdll.dll, 0x76f8b3f5ntdll.dll, 0x76f8b3c8

Editing a resource file is not reflected in the site?



I am editing core.resx file which is located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources location.

I am changing :

<data name="cui_ButNoteBoard">
    <value>Note Board</value>


<data name="cui_ButNoteBoard">

Basically I want to customize the dialog box which appears on click of the comments icon present on the right side of the page header in SP 2010. I want to change the title of one tab in dialog box(from 'Note Board' to 'Comments').

But the change is not reflected in the tab title. Am i missing something here or updating the wrong resource file?

Please guide.



WCF NetDispatcherFaultException - Throws exception only when I include file (List)


Hi All,

My service would return a file (List<byte> - use WSSF so dont know why it is a list rather than a byte array. When I consume the service it throws the following exception:

"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.tempuri.org. The InnerException message was 'Error in line 1 position 1124. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. '.  Please see InnerException for more details."

Any ideas on how to fix it would be much appreciated.



File is deleted but exception is thrown. How it is possible?


Hello everybody.

I am passing a file name via query string. When I am trying to delete the file it is throwing a FileNotFoundException. But the file practically deleted from the server. Both of the following codes of file delete :

File.Delete(Server.MapPath("~/Files/") + Request.QueryString["FileName"]);
File.Delete(Server.MapPath("~/Files/" + Request.QueryString["FileName"]));

are throwing that exception.

Can any one please tell me what is the reason behind this behavior or what I am doing wrong?

Thank you.

File do exist in the output directory, But always FileNotFound Exception


Hi all,

I have a solution with several projects, some of them are C# whlie others are C++.net. the c++ projects are used as reference libraries for the c# projects.

the solustion can be complied and run well in 32-bit system, but when i built it in 64-win7, I  change all project to win32 platform.  when i managed to build the solution, and try to run  from one of the c# form appliction project which depend on on c++ project, there alway throw fileNotFoundException as follow:

System.IO.FileNotFoundException was unhandled
  Message=Could not load file or assembly 'CvAdapter.dll' or one of its dependencies. The specified module could not be found.
       at GraphicResarch.DisplayForm..ctor()
       at GraphicResarch.Program.Main() in D:\Develop\Code\AIStudio\AISeeStudio\GraphicResarch\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

Trouble reading XML file (exception after first entry)



I'm able to write out an XML file that put the values of a few textboxs in the XML file for saving, but when I try to read it back in, it stops after the first line and gives me an exception.

Here is the code:

private: System::Void openXMLToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e)
			Stream^ myStream;
			XmlTextReader^ xmlTxtReader;

				if (openFileDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)		
					if ( (myStream = openFileDialog->OpenFile()) != nullptr )
						xmlTxtReader = gcnew XmlTextReader(this->openFileDialog->FileName);
						while (xmlTxtReader->Read())
							if(xmlTxtReader->Name == "BoardNameTextBox1" && xmlTxtReader->NodeType == XmlNodeType::Element)
								this->BoardNameTextBox1->Text = xmlTxtReader->ReadElementString(

Server error: is checked out or locked for editing by ... but page does not exist


I tried to rename a page in the source variation of a Publishing Site using Site Content and Structure tool, let's call it "newpage". This threw an HTTP 500 error. I then tried to rename it in SharePoint Designer. I got two message prompts, the first said:

"A file with the name Pages/newpage.aspx already exists. Do you want to replace this file?"

There is no file of that name in the Pages list in either the source or target variation. I said "Yes" and got the following error:

"Server error: The file <path>/newpage.aspx is checked out or locked for editing by ."

No user name was given in the message. I can successfully rename the page in the target variation to have the new name.

I also cannot create a new page in the source variation called newpage.aspx, I get an error saying that there is already a page of that name ... but there isn't. I have cleared the site and site collection recycle bins.

HTML comments in ASPX file causes exception


Hi, I'm new to ASP.NET MVC 2 but I've done webforms programming. In my first MVC2 test project in VS 2010 I got an error that surprised me. Code inside HTML comment tags are obviously parsed and sometimes even causes exceptions. This seems to me like a strange break with a programming paradigm that is as old as programming itself.

The code section in question is a form inside a user control.

Code that runs OK:

   <% using (Html.BeginForm("Index", "Search")) {%>
            <input id="SearchText" name="SearchText" type="text" />
            <input type="submit" value="Search..." />
    <% } %>

Code that causes YSOD:

   <% using (Html.BeginForm("Index", "Search")) {%>
            <!--<asp:TextBox ID="AccountText" runat="server" Width="226px"></asp:TextBox>-->
            <input id="SearchText" name="SearchText" type="text" />
            <input type="submit" value="Search..." />
    <% } %>

The error message given is Control 'c

File not found exception when use SPSite site = new SPSite(uxAddress.Text);

The Web application at http://v-johnzh-test01/SitePages/Home.aspx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

File not found exception when use SPSite site = new SPSite(uxAddress.Text);


The Web application at http://v-johnzh-test01/SitePages/Home.aspx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

I already set the platform as x86.

No Endpoint exception on large file sending through https




I have a WCF webservice. I'm using https for communication between client and server. Everithyng works fine till the file I send through WCF is smaller then ~20MB.

When I want to attach a larger file I get exception. I turned on the diagnostic logging and saw this exception:

<ExceptionString>System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://MyServer/MyWebApp/MyService.svc/ws that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---&gt; System.Net.WebException: The remote server returned an error: (404) Not Found.
  at System.Net.HttpWebRequest.GetResponse()
  at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
  --- End of inner exception stack trace ---</ExceptionString>

Editing an item whose draft item is waiting for approval causes runtime exception



I have a list where content approval is enabled by going to Version Settings page of the list. I have allowed to view the draft items only by the author of the item (who created the item) and the person who can approve. Now if an item's draft item is pending for approval, and if another user (who is neither the author nor the user from approver group) try to edit the item, he/she gets runtime error. The more details are reported on the site http://ranaictiu-technicalblog.blogspot.com/2010/11/sharepoint-2010-editing-item-whose.html


I'm not sure if the error is reported already. Can anybody help?


Sohel Rana

Unable to read the security policy file for trust level 'WSS_Minimal' after editing 'Alternate Ac



This is my first post, so I hope that I have picked the correct forum - it seemed the most appropriate.
I am pretty green when it comes to SharePoint admin, but as it was going so well I got a bit over-confident and tried out the 'Alternate Access Mapping'.  I didn't intend to save any changes, but I must have, because now under:

Central Administration > Operations > Alternate Access Mappings >
Edit Public Zone URLs

the 'Default' is "http://<myServer> : <port>"

and afaik there was no setting there before.  Unfortunately, I can no longer connect to http://myServer : port, although I can connect to the 'Central Administration' site on http://myServer : otherPort.  Apologies in advance for the data dump below, but if anyone has any suggestions on what I could've done (or even better what I could do to fix it before tomorrow :-) I would be very grateful.

Here are the errors that I saw/see in the browser:

gettting exception when uploading a file using IE 6??? not a valid virtual path




I have a file upload control and just in IE 6 I get the following error when I try to upload a file. My code is further below.


 Exception Details: System.Web.HttpException: '/Members/path//C:\Users\Public\Pictures\Photos\Sample Album\Pensive Parakeet.jpg' is not a valid virtual path


MembershipUser newUser =


        HttpFileCollection uploadedFiles = Request.Files;

        for (int i = 0; i < uploadedFiles.Count; i++)


            HttpPostedFile file = uploadedFiles[i];
            string fileExt = Path.GetExtension(file.FileName).ToLower();
            string fileName = Path.GetF

File not Found Exception DocLib Url



i am retrieving a file not found exception when i try to access the doclib-url which is called "Immo", to perform a fulltext search within. Does anybody know, what the correct url-format is ?



ContRep = CRsite.GetListFromUrl("http://localhost/immobench/Immo/Forms/AllItems.aspx");

thx a lot

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