Click here to Skip to main content
12,078,795 members (54,896 online)
Rate this:
 
Please Sign up or sign in to vote.
Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\bin\XMLStaticData.xml'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\bin\XMLStaticData.xml'.

Source Error:


Line 43:
Line 44:
Line 45: XElement xe = XElement.Load("~/bin/XMLStaticData.xml");
Line 46:
Line 47: List lstGeneralEntity = new List();

Source File: D:\Back up of Ishan\Projects\New folder\TMOyeTrivia\BusinessLayer\MiscOperations.cs Line: 45

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\bin\XMLStaticData.xml'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +224
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +1142
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +81
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) +77
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +69
System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) +125
System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) +43
System.Xml.Linq.XElement.Load(String uri, LoadOptions options) +52
System.Xml.Linq.XElement.Load(String uri) +6
BusinessLayer.MiscOperations.PopulateStaticDDL(String strEntityName) in D:\Back up of Ishan\Projects\New folder\TMOyeTrivia\BusinessLayer\MiscOperations.cs:45
TMOyeTrivia.Default1.PopulateCountryDDL() in D:\Back up of Ishan\Projects\New folder\TMOyeTrivia\TMOyeTrivia\Default.aspx.cs:65
TMOyeTrivia.Default1.Page_Load(Object sender, EventArgs e) in D:\Back up of Ishan\Projects\New folder\TMOyeTrivia\TMOyeTrivia\Default.aspx.cs:35
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Posted 6-Jan-13 20:21pm
ishandeb1.1K
Edited 6-Jan-13 21:03pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Check if the following file path exists on your system - "C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\~\bin\XMLStaticData.xml". Most likely, you are trying to read a file that does not exist.
You could also be trying to read the file from an incorrect location.

In addition, you can check if the file exists[^] using simple File operations before trying to open the file.
  Permalink  
Comments
ishandeb 7-Jan-13 1:42am
   
i just want to check if the file is in my project.
Abhinav S 7-Jan-13 2:08am
   
Use File.Exists.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

I understand your problem, as its a web application you don't have any EXE, when you run it runs under VS temporary Web Server which local is that where your appication is searching for that XML file.

In web application when ever you try to access any local resource please Server.MapPath("[Path]")
It will solve your problem.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web03 | 2.8.160212.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100