Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference in physical path, root path, virtual path, relative virtual path, application path and absolute path?

I have some confusion in understanding what is different in various paths available in .Net for a resource.

I only guess Physical path is OS directory path for a resource. I am confuse and event can't tell about what path basically I need to use.

like image 662
user576510 Avatar asked Dec 13 '12 22:12

user576510


People also ask

What is virtual path and physical path?

Physical path - This is the actual path the file is located by IIS. Virtual path - This is the logical path to access the file which is pointed to from outside of the IIS application folder. Let's display this image from Hard-drive 'E' using a virtual directory in IIS Default web site.

What is physical path?

The physical path between two subarea nodes is an explicit route. Explicit route (ER) An explicit route is an ordered set of subarea nodes and transmission groups along a path between communicating subarea nodes, including: The endpoint subareas. Any subareas between the endpoint subareas.

What is relative path and absolute path?

An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words,we can say that an absolute path is a complete path from start of actual file system from / directory. Relative path. Relative path is defined as the path related to the present working directly(pwd) ...

When saving geographic data What is the difference between the relative path name and the absolute path name?

A relative path is distinguished from and absolute path by referencing a resource with relation to the object in question. For example, consider the directions to a person's house. A street address is an absolute path; there is no ambiguity in 123 First Street, Anytown, USA 12345.


2 Answers

In regards to an ASP.NET application I think of it like this:

Physical Path: OS path using drive/directory/file in which the actual app doesnt really use this path but if it did it would be mapped using a virtual path. A physical path is how the OS locates the resource/s ie: c:\\inetpub\wwwroot\aspnetapp The actual app only cares about paths relative to its root directory.

Root Path: This would be the URI or URL at the root of your aspnetapp or ~/Home/Index with proper route config (Not to be confused with Unix Root Directory naming convention). http://www.yardpenalty.com could actually be the location of this example's physical path in terms of an OS/NOS.

Virtual Path or Relative Virtual Path: The path that the application identifies or is identified by from its Web server.

For instance, in IIS (or OWIN) you may have a resource directory for your images in folder c:\\inetpub\ftp\images but the developer maps this folder to the app like so... ~\Images. So think of this as the ability to create a relative path to resources identifiable by your app and its users while physically located elsewhere.

I would imagine that using a virtual path under a root application would be helpful in development when there are one or more projects that the developer wishes to give the appearance of a single application under a single domain.

Absolute Path: The entire path to a resource. Let's say you have a link that takes you to a specific route like this: <a href="http://www.yardpenalty.com/home/about"> About</a>. If this link was in the layout or master page a relative path <a href="~/home/about">About</a> would be cleaner. There are instances when you need to hard code an absolute path but it is typically wiser to use relative paths especially when development involves migrations.

like image 128
yardpenalty.com Avatar answered Sep 18 '22 17:09

yardpenalty.com


Relative path to the current working directory - Sometimes you can find a path description in a format like this ./Directory/Filename.Ext and it means that the path is specified relatively to the current application working directory.

like image 29
Honza P. Avatar answered Sep 17 '22 17:09

Honza P.