Tuesday, February 14, 2017

Difference between Virtual Path, Absolute Path, Relative path And Physical Path



Virtual Path
 To create a web app in IIS we can place our folder containing application in C:\inetpub\wwwroot or we can point to a location where the application is, like D:\MyApp. When we point an app to another location, then we specify this path. So the app in IIS is pointing to this virtual path.

Absolute Path
When we refer to a location from root like C:\Documents\MyFolder, it is absolute path.

Relative path
When we refer to a location relative where we currently are, it is called relative path. For example, say currently you are at Documents folder in C:\Documents, to refer to MyFolder you have two choices: Absolute (C:\Documents\MyFolder) or relative (\MyFolder).

Physical Path
In ASP.NET physical path refers to the absolute path in terms of windows. In web applications we refer to the web path, which for a web application starts from "/" (root) which is the folder that contains the application. But that root folder must be in IIS, so the path like C:\inetpub\wwwroot\myapp is the physical path.