The tilde (~) resolves to the application's root. This can be something like / (when accessing the site at www.domainname.com
for example), or something like /ApplicationName/ (when accessing the site as www.domainname.com/ApplicationName
and where ApplicationName is marked as an application in IIS).
It only works on server side controls / code, so depending on where you use the path you provided it may or may no work. For more info: