Virtual Path Error in ASP.NET

I am trying ftp files that I upload to my web server that my website is hosted on.  I can successfully upload the files to a directory on the C:\ drive, but when I try to ftp them and point to them in my code, I am getting the error stating 'C:\...' is not a valid virtual path.

My site is hosted in IIS, so the web files are stored in that location.  I am trying to point to a location that is not in the same root directory.

I've tried ..//, ~/, and several other techniques, but I can't get it to work.

Any Ideas?
jamesdean666Asked:
Who is Participating?
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.

Alfred A.Commented:
Use Server.MapPath
0
Alfred A.Commented:
Do it something like

Dim FILENAME As String = "C:\websites\" + TextBox1.Text + ".txt"
0
Alfred A.Commented:
Oops,  I left the server.mappath.  Sorry!

Dim FILENAME As String = Server.MapPath("C:\websites\"  + TextBox1.Text + ".txt")
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Alfred A.Commented:
Oh, Correction from my previous post use relative addressing rather than the one I provided.

Check this out:

http://msdn.microsoft.com/en-us/library/ms524632%28VS.90%29.aspx
0
Alfred A.Commented:
Example of Virtual Path (relative addressing) using Server.MapPath.

Dim path As String = Server.MapPath("Images/blueWave.JPG")
Dim path As String = Server.MapPath("../Images/blueWave.JPG")
Dim path As String = Server.MapPath("~/Images/blueWave.JPG")
0

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
jamesdean666Author Commented:
Yahtzee.... Thanks...
0
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
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.