There are a lot of questions that once you answered them they look like really simple, some even stupid. This post is about the answer of one of this kind of questions.
How to know the application path in server side of an ASP.Net page?
One of many ways is to use the MapPath method of the Page class:
The use of “~” is new in ASP.Net 2.0 and represents the root path for an application.
Usually you don’t need to know the server side application path, but suppose you have the page deployment in a hosting environment and you need to access a writing permission directory outside of the application path or any other URI Web visible.
If you know the server directory structure, you can simulate it in your development system, usually in a virtual directory in IIS, but your application must be deployed in the domain name root.
In your development server you have one directory structure for you application and your server and in the production server you have another one. So, you need to know the server side path of you application in order to locate correctly the writing permission directory