Last post Aug 08, 2017 03:24 PM by RageRiot
Aug 08, 2017 02:28 PM|RageRiot|LINK
I have a physical path stored in my "live" web.config:
And the same for my "localhost" web.config:
When I try to save a file on the live system, it works fine:
AjaxFileUpload.SaveAs(Server.MapPath(mywebconfigpath + "filename.mp3"));
But on my local server I get:
Additional information: 'C:\examplepath\localhost\filename.mp3' is a physical path, but a virtual path was expected.
What should I be doing?
Aug 08, 2017 03:07 PM|HostingASPNet|LINK
You could check for the solution at
Aug 08, 2017 03:14 PM|march11|LINK
It should be something like this.....
Assuming you are saving to the sites root location, and the correct permissions are applied, I do not recommend this though as it is a huge security issue.
The storage location being referenced by the virtual path is the root location of the web site. You could create an upload folder and send the files there and only give that folder location the permissions needed to write to the drive.
The tilde allows the operating system to use the server path to get to the location.
Aug 08, 2017 03:16 PM|RageRiot|LINK
The problem is I want to save the files to a different drive than C: - I could in theory save them anywhere when on localhost though.
Aug 08, 2017 03:24 PM|RageRiot|LINK
Thanks all, I'll just save the localhost files somewhere within the root as it's only me who'll be using it.