ASP.NET offers two ways to specify paths for style sheets:
<link href="/common/black_theme/css/style.css" rel="stylesheet"> (this is working) <link href="~/common/black_theme/css/style.css" rel="stylesheet"> (this is not working)
As per my knowledge, ~
represents the root directory of the application. "common" is the folder below the website root (named testsite.demo
) in IIS.
Physical path: D:\Physicalpath\WarpFirstSite\testsite.demo
"common" folder: D:\Physicalpath\WarpFirstSite\testsite.demo\common
This is where the dot slash ./ notation comes in. It means “Look in the current directory.” When you use ./, you tell Ubuntu or Fedora or SUSE or whatever Linux distribution you're using to look in the current directory for the command you wish to run, and completely ignore what's on the application 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) ...
Yes, ./ means the current working directory. You can just reference the file directly by name, without it.
An absolute path is the full path to a file or directory. It is relative to the root directory ( / ). Note that it is a best practice to use absolute paths when you use file paths inside of scripts. For example, the absolute path to the ls command is: /usr/bin/ls . If it's not absolute, then it's a relative path.
/
- Site root~/
- Root directory of the applicationThe difference is that if you site is:
http://example.com
And you have an application myapp
on:
http://example.com/mydir/myapp
/
will return the root of the site (http://example.com
),
~/
will return the root of the application (http://example.com/mydir/
).
The second won't work because its not a recognised path by anything except asp.net code on the server side. And since your link tag is regular html and not a server control it never gets processed.
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