I am trying to upload image to a folder called
~/Avatars/
.
My project is located in VS2010 projects folder `C:/Projects/MyProject.
When i try to get physical path to Avatars folder by
Server.MapPath("/Avatars")
it always returns
C:\inetpub\wwwroot\Avatars
instead of
C:\Projects\MyProject\Avatars.
It works fine when I run the project on VS2010 dev server.
Can anyone help me how to get actual path in IIS?
Seems like you're deploying to IIS and that's the default folder for deployment. When you run locally, dev server runs off your local folder.
What you need is Server.MapPath("~/Avatars")
or Server.MapPath("Avatars")
. Also, make sure when you deploy to IIS, you're site is being deployed to C:\inetpub\wwwroot\My Project\
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With