Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a site I've been on for a while. Users should be able to upload XML files. To get this done, I used the FileUpload control in vs2000 like this.

ASP.NET
<INPUT id="upload" type="file"  runat="server">

I also added this code to bind that XML data in datagrid in the code-behind page:

C#
conDB.Open()
       Dim reportData As New DataSet()
       Private strFileName As String
       strFileName = upload.PostedFile.FileName
       'reportData.ReadXml(Server.MapPath(strFileName))
       reportData.ReadXml(strFileName)
       GridView1.DataSource = reportData
       GridView1.DataBind()
       conDB.Close()


The problem is when I try to do the upload a file(KPMCLT0001_shg_memberloan_Jan12.xml) from my local system, It give the error -

Could not find file "C:\WINDOWS\system32\KPMCLT0001_plf_memberwise_Jan12.xml".
Any idea
Posted
Updated 16-Mar-12 20:53pm
v4

1 solution

'c:\windows\system32\inetsrv\' is the default "Current Directory" when running in ASP.NET

If you can provide more details about what every file location related string currently has in it when the exception is thrown. You need to give the full path of the exact file location in server.
 
Share this answer
 
Comments
rajrprk 17-Mar-12 2:52am    
Here i m going to import an XML file, When i import XML file in my local machine i getting the following errors like..

Could not find file "C:\WINDOWS\system32\KPMCLT0001_plf_memberwise_Jan12.xml".
KPMCLT0001_plf_memberwise_Jan12.xml This is XML file name what i tried to import.
Exception Details: System.IO.FileNotFoundException: Could not find file "C:\WINDOWS\system32\KPMCLT0001_plf_memberwise_Jan12.xml".

Once i place this KPMCLT0001_plf_memberwise_Jan12.xml file in this location C:\WINDOWS\system32\ i didn't get error. But i dont want to place that file in C:\WINDOWS\system32\

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


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