Click here to Skip to main content
15,896,541 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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<generalentity> lstGeneralEntity = new List<generalentity>();

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
Updated 6-Jan-13 20:03pm
v2

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.
 
Share this answer
 
Comments
[no name] 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.
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900