Reputation: 40970
I can access the physical location of a server using Server.MapPath
. This gives me the physical path that is inside of wwwroot
folder.
I want to Save some data into the other drive of the same server say D:
drive. I think I can't get the physical location of D:
drive using Server.MapPath
because it is outside of the wwwroot
folder. So I will hardcoded this location into my project. But now the problem is I want to access the saved data using server url like www.mysite.com/image/myimage.png
where image/myimage.png
located in D:
drive. So I just want to know is it possible or not using asp.net or please suggest what should i do to overcome this problem
Upvotes: 4
Views: 2424
Reputation:
That is impossible or then it would be possible for any one to make script to upload files to any folder he wants. If you have access to the server consider making application to move your files.
Upvotes: 1
Reputation: 16733
Ok, a couple things:
Don't hardcode your location, use appsettings in your web.config, that's what they are there for: http://msdn.microsoft.com/en-us/library/610xe886%28v=vs.100%29.aspx
You want to serve images from another drive. You need to set up a virtual directory in IIS under your website to achieve this: http://support.microsoft.com/kb/172138
Upvotes: 6