Overriding the meaning of ~ in ASP.NET

Random techie discovery… You can override the meaning of the tilde (~) in paths in ASP.NET.

I often use the ~ so that it doesn’t matter whether my web application is sitting at the root level or in a virtual directory. For example, I could include this as the href of a link tag to make ASP.NET write out the correct path of a stylesheet:

~/App_Assets/Css/Screen.css


I discovered today that you can override the meaning of that ~, to potentially point anywhere you like, such as a subfolder. See here for details.