The simple ~ (tilde) character
Posted by CJ on July 30, 2006
This is a simple post about a simple character ~
Until a few months ago I had no use for this key on my keyboard. It was just taking up an otherwise blank space and was there only for looks.
Yesterday I benefited in the use of this simple character while maintaining an ASP.NET application. In previous web applications you might do something like the following ../Images/Header.gif which makes this path hard coded. What if I changed my structure around and moved my web page to a lower directory level? That is correct, my reference is broken. I have to go into my page and manually change it ../../Images/Header.gif. This is also valid for href’s. Urrhhhh…not much fun.
A year or so ago I came across an article that discussed using the ~ character (I didn’t even know what the characters name was) for runtime resolution. You simply reference the previous example like ~/Images/Header.gif. This means that no matter how many directories your web page is buried in, the reference path will be resolved at runtime.
The tilde character works with any ASP.NET server control (runat=”server) and server-side code but not with html controls.
One point worth noting is that while in design mode you might not be able to view the image, but rest assured it will display at runtime.
BTW, if you are interested in the origin of the great ~ character then check this out.
kooovfsj said
pussy sex videos
wnkhjsy icvnpck uqvewktpci ksubtarw mqiubwvmb pkpjuzvjixg ldfdkdbmhxq vfwmihurrc