could not find a part of the path...

G

Guest

Could not find a part of the path...

I have developed an application that has a filetype, Filename.llsx,
association. My problem is tha on some computers i get a
System.IO.DirectoryNotFoundException when i try to download files of my
filetypes from the internet.

Here is the code that tries to read the file:

Dim rd As New System.IO.StreamReader(fileName)
Dim myXmlDocument As New System.Xml.XmlDocument
myXmlDocument.Load(rd)

Here is the error stack:

System.IO.DirectoryNotFoundException:

Could not find a part of the path 'C:\Documents and
Settings\Mats-Erik\Lokala inställningar\Temporary Internet
Files\ContentUTF8.IE5\S9U70XI3\WebReport_2006-05-11-09-20-54[1].llsx'.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at 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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding)

Thanks in advance!
 
V

VJ

Are you creating the directory and then downloading the file?.. , do a
File.Exists check.. and then load.. it will work without error.. just make
sure whatever algorithm that you have to create directories and copying
file, is working properly...

Vijay
 
G

Guest

It is Internet Explorer that controls the path of file-downloads from
internet. Internet Explorer uses directory ...\Temporary Internet Files\...
and creates sub directorys. So i can't control the creation of directorys .

VJ said:
Are you creating the directory and then downloading the file?.. , do a
File.Exists check.. and then load.. it will work without error.. just make
sure whatever algorithm that you have to create directories and copying
file, is working properly...

Vijay

MrGrundh said:
Could not find a part of the path...

I have developed an application that has a filetype, Filename.llsx,
association. My problem is tha on some computers i get a
System.IO.DirectoryNotFoundException when i try to download files of my
filetypes from the internet.

Here is the code that tries to read the file:

Dim rd As New System.IO.StreamReader(fileName)
Dim myXmlDocument As New System.Xml.XmlDocument
myXmlDocument.Load(rd)

Here is the error stack:

System.IO.DirectoryNotFoundException:

Could not find a part of the path 'C:\Documents and
Settings\Mats-Erik\Lokala inställningar\Temporary Internet
Files\ContentUTF8.IE5\S9U70XI3\WebReport_2006-05-11-09-20-54[1].llsx'.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at 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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding
encoding)

Thanks in advance!
 
C

Chris Dunaway

Yes, but you are trying to read the file using a StreamReader. You
need to use File.Exists to check for the existence of the file before
you try to open it with the StreamReader. I would speculate that, for
whatever reason, the file you are trying to open is not present in the
folder indicated. Maybe it is not done downloading yet.
 
G

Guest

Thanks Chris!

You are right, the file or path does not excists. Do you have to create a
wait loop in your program and check/re check if the file has downloaded
complete? Why does this work on some computer?
 
L

Linda Liu [MSFT]

Hi,

You should use File.Exists to check if the file exists just once before you
try to open it and you don't need to create a wait loop in your program to
check the existence of the file.

If you have any other concerns or need anything else, please don't hesitate
to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 
G

Guest

Dear Linda!

Okey i will try to explain my problem once again:

I try to download a file, that i know excists on the website, from my
website (.NET). The filetype of the file is asscoiated with my windows forms
program.
When i try to open the file from the website,a link, it recognizes the
filetype and starts my program but then the error occurs on some computers:

System.IO.DirectoryNotFoundException:

Could not find a part of the path 'C:\Documents and
Settings\Mats-Erik\Lokala inställningar\Temporary Internet
Files\ContentUTF8.IE5\S9U70XI3\WebReport_2006-05-11-09-20-54[1].llsx'.
 
L

Linda Liu [MSFT]

Hi,

Thank you for your reply.

Maybe the problem is caused by the Internet Explorer on your machine. You
may have a try deleting all files in the temporary Internet files. To do
this, please open your IE, select the "Tools" menu and "Internet Options"
menu item. In the Internet Options window, click the "Delete Files" button
in the "Temporary Internet files" groupbox. Then a Delete Files window
appears. In this window, select the "Delete all offline content" checkbox
and then click OK.

Hope this is helpful to you.
If you have any other concerns or need anything else, please do not
hesitate to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

====================================================
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top