When you want to read a file in you’re website folder, you get the error:
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path ‘c:\windows\system32\inetsrv………’.

This is because you will have to map you’re path: http://msdn.microsoft.com/en-us/library/ms178116.aspx

 DataSet ds = new DataSet();
 ds.ReadXml(Server.MapPath(@"~\Data\ImageInGridView.xml"));


StackTrace info

[DirectoryNotFoundException: Could not find a part of the path ‘c:\windows\system32\inetsrv\Data\ImageInGridView.xml’.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +492 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) +1038 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) +113 System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +78 System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +51 System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +44 System.Threading.CompressedStack.runTryCode(Object userData) +54 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0 System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state) +174 System.Xml.XmlTextReaderImpl.OpenUrl() +199 System.Xml.XmlTextReaderImpl.Read() +53 System.Xml.XmlTextReader.Read() +12 System.Xml.XmlReader.MoveToContent() +70 System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving) +254 System.Data.DataSet.ReadXml(String fileName) +62

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.