Link to home
Start Free TrialLog in
Avatar of jamesdean666
jamesdean666

asked on

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?
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Use Server.MapPath
Do it something like

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

Dim FILENAME As String = Server.MapPath("C:\websites\"  + TextBox1.Text + ".txt")
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
ASKER CERTIFIED SOLUTION
Avatar of Alfred A.
Alfred A.
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jamesdean666
jamesdean666

ASKER

Yahtzee.... Thanks...