Error when accessing Excel Spreadsheet

I have created a Visual Studio 2013 Webforms Project using VB.Net. The application allows users to upload values from an Excel Spreadsheet directly into a SQL Server 2012 database table. Everything seems to go ok until I attempt to access the excel file. I get the following error:

Server Error in '/' Application.

Could not find a part of the path 'c:\users\dmartin\documents\visual studio 2015\Projects\Tresults\Tresults\Files\sheetst.xlsx'.
  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:\users\dmartin\documents\visual studio 2015\Projects\Tresults\Tresults\Files\sheetst.xlsx'.

It appears that the code is automatically looking for the file to be located in a specific loation. This would never be the case because users can store their files anywhere.

I receive and error on the following Code Behind page:
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        If FileUpload1.HasFile Then
            Dim FileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
            Dim Extension As String = Path.GetExtension(FileUpload1.PostedFile.FileName)
            Dim FolderPath As String = ConfigurationManager.AppSettings("FolderPath")

            Dim FilePath As String = Server.MapPath(FolderPath + FileName)
            GetExcelSheets(FilePath, Extension, "Yes")
        End If
    End Sub

Open in new window

I have the following in my web config:
    <add key="FolderPath" value="Files/"/>

I thought this would be fairly straight forward. The other strange issue is I don't get the error if I just create and empty website and add the files and webconfig with the same settings. VB.aspx.vb
derrekdeveloperEnterprise Solution ArchitectAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CD, MVPOwnerCommented:
you have to (a) upload the file to the server and (b) have excel installed on the web server to process the file

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.