I have a script file .
<script src="~/Scripts/angular.js"></script>
See the path is ~/Script
. But if I Entered ../../
instead of ~/
,Also the process are working same .
My website URL like : https://sample.com/Scripts/angular.js
If I entered ../../
in before Scripts
,then it's automatically change previous URL(https://sample.com/Scripts/angular.js)
.
What is the url process ? And how can its automatically changed? and please tell about the Different between
./, ../ , ../../ , ~/ ,/Scripts ,Scripts
?
It means that the directory App_Data is in the root of the current application. ASP.NET Web Site Paths.
Path/File. The path refers to the exact location of a page, post, file, or other asset. It is often analogous to the underlying file structure of the website. The path resides after the hostname and is separated by “/” (forward slash). The path/file also consists of any asset file extension, such as images (.
Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy. A single dot represents the current directory itself.
The set of names required to specify a particular file in a hierarchy of directories is called the path to the file, which you specify as a path name. Path names are used as arguments for commands.
These path components are shortcuts with specific meanings:
.
means the current path level (so if you're on index.aspx
and you reference ./style.css
then the latter would have to be in the same folder as the former)..
means one path level up (so if you're on /somefolder/index.aspx
and you reference ../style.css
then the latter would have to be in the parent folder of someFolder
)/
means the root level (so /style.css
is the same as http://www.mysite.com/style.css
)~
in ASP.NET means the server-side application root (so ~/index.aspx
would be translated to the URL of the index.aspx
file that's in the application's root)There are a number of things to note here:
~
. That can only be used in paths which are pre-processed in server-side components. The server-side components would then know to translate that into a client-visible path based on the current location of the application relative to the web server...
) have no limit. The root's parent is considered the root. So if you're on http://www.mysite.com/someFolder/index.aspx
and you reference ../../../../style.css
it will go to http://www.mysite.com/style.css
.../somePage.aspx
, but when you hover over it with your mouse the browser indicates that it's http://www.mysite.com/somePage.aspx
. This is because the browser has converted the relative path of the former into the absolute path of the latter.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