Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Could not find file Error

Reply
Thread Tools

Could not find file Error

 
 
Amritha.Datta@gmail.com
Guest
Posts: n/a
 
      07-23-2007
Can anyone tell me why the below code returns error?
Exception Details: System.IO.FileNotFoundException: Could not find
file

Dim strLFolder As String = "c:\Temp\F Files"
Dim intClientID As Integer = 1221

Dim XMLStr As String = strLFolder & "\" &
intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
Dim dsPubs As New DataSet
dsPubs.ReadXml(XMLStr)

where as the below code is working

Dim dsPubs As New DataSet
dsPubs.ReadXml("c:\temp\F Files\1221\Lk
\HeaderTrailerDeltails_data.xml")


Thanks

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      07-23-2007
Is Deltails in both intentional ?

My approach would be to read the directory content using DirectoryInfo and
do a char by char comparison to get the first mismatch char so that this is
my computer that works to find the difference (for example you could have a
non secable white space character that would be near impossible to find by
just looking).

--
Patrice

<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed) om...
> Can anyone tell me why the below code returns error?
> Exception Details: System.IO.FileNotFoundException: Could not find
> file
>
> Dim strLFolder As String = "c:\Temp\F Files"
> Dim intClientID As Integer = 1221
>
> Dim XMLStr As String = strLFolder & "\" &
> intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
> Dim dsPubs As New DataSet
> dsPubs.ReadXml(XMLStr)
>
> where as the below code is working
>
> Dim dsPubs As New DataSet
> dsPubs.ReadXml("c:\temp\F Files\1221\Lk
> \HeaderTrailerDeltails_data.xml")
>
>
> Thanks
>



 
Reply With Quote
 
 
 
 
Amritha.Datta@gmail.com
Guest
Posts: n/a
 
      07-23-2007
On Jul 23, 1:41 pm, "Patrice" <http://www.chez.com/scribe/> wrote:
> Is Deltails in both intentional ?
>
> My approach would be to read the directory content using DirectoryInfo and
> do a char by char comparison to get the first mismatch char so that this is
> my computer that works to find the difference (for example you could have a
> non secable white space character that would be near impossible to find by
> just looking).
>
> --
> Patrice
>
> <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed) om...
>
> > Can anyone tell me why the below code returns error?
> > Exception Details: System.IO.FileNotFoundException: Could not find
> > file

>
> > Dim strLFolder As String = "c:\Temp\F Files"
> > Dim intClientID As Integer = 1221

>
> > Dim XMLStr As String = strLFolder & "\" &
> > intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
> > Dim dsPubs As New DataSet
> > dsPubs.ReadXml(XMLStr)

>
> > where as the below code is working

>
> > Dim dsPubs As New DataSet
> > dsPubs.ReadXml("c:\temp\F Files\1221\Lk
> > \HeaderTrailerDeltails_data.xml")

>
> > Thanks


The directory is valid and existing in the hard disk.
The problem is why it is throwing error if I use the first method?

I will have to use the first method because that enable me to get
different clientID values dynamically in the program.

Thanks

 
Reply With Quote
 
Patrice
Guest
Posts: n/a
 
      07-24-2007
I don't see any obvious reason but my first assumption would be that this is
for some legitimate reason. So once again I would code a file name
comparision to make sure that there is no mismatch in particular regarding
white spaces that are almost uncheckable by just looking at them. Have you
tried what I have suggested ?

Also what if you try both code you submitted but using a single variable
that contains the file name (this way you are 100% sure that both file name
are the same) ?

Etc....
--
Patrice

<(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed). com...
On Jul 23, 1:41 pm, "Patrice" <http://www.chez.com/scribe/> wrote:
> Is Deltails in both intentional ?
>
> My approach would be to read the directory content using DirectoryInfo and
> do a char by char comparison to get the first mismatch char so that this
> is
> my computer that works to find the difference (for example you could have
> a
> non secable white space character that would be near impossible to find by
> just looking).
>
> --
> Patrice
>
> <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed) om...
>
> > Can anyone tell me why the below code returns error?
> > Exception Details: System.IO.FileNotFoundException: Could not find
> > file

>
> > Dim strLFolder As String = "c:\Temp\F Files"
> > Dim intClientID As Integer = 1221

>
> > Dim XMLStr As String = strLFolder & "\" &
> > intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
> > Dim dsPubs As New DataSet
> > dsPubs.ReadXml(XMLStr)

>
> > where as the below code is working

>
> > Dim dsPubs As New DataSet
> > dsPubs.ReadXml("c:\temp\F Files\1221\Lk
> > \HeaderTrailerDeltails_data.xml")

>
> > Thanks


The directory is valid and existing in the hard disk.
The problem is why it is throwing error if I use the first method?

I will have to use the first method because that enable me to get
different clientID values dynamically in the program.

Thanks


 
Reply With Quote
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      07-25-2007
I bet your problem is with permissions.
You may need to adjust the security on that folder to allow the ASPNET (or
NetworkService) user the necessary permissions.
Alternately you could use impersonation to have ASP.NET run under a
different user account:
<!-- Web.config file. -->
<identity impersonate="true" userName="Redmond\BillG" password="Melinda"/>

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Can anyone tell me why the below code returns error?
> Exception Details: System.IO.FileNotFoundException: Could not find
> file
>
> Dim strLFolder As String = "c:\Temp\F Files"
> Dim intClientID As Integer = 1221
>
> Dim XMLStr As String = strLFolder & "\" &
> intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
> Dim dsPubs As New DataSet
> dsPubs.ReadXml(XMLStr)
>
> where as the below code is working
>
> Dim dsPubs As New DataSet
> dsPubs.ReadXml("c:\temp\F Files\1221\Lk
> \HeaderTrailerDeltails_data.xml")
>
>
> Thanks
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Could not find file 'C:\WINDOWS\TEMP\awbwxpt6.dll' Jerry C ASP .Net 4 01-13-2010 02:46 AM
could not find file (.msi,.exe,.tmp) error in building web setupproject! chandan ASP .Net 2 03-12-2008 09:26 AM
Parser Error Message: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The system cannot find the file specified. hifiger2004 ASP .Net Web Controls 1 08-30-2007 04:12 PM
Folder creation error: "Could not find a part of the path" error E. Kwong ASP .Net Web Controls 0 11-06-2006 11:20 PM
Error Message: Outlook Express Could Not Be Started Because Msoe.dll Could Not Be Loaded Dutch Treat Computer Support 4 06-21-2004 02:01 PM



Advertisments