The Mighty Tilde
But one of the best kept and largely undocumented secrets in ASP.NET is the tilde character (~). The tilde is actually a shortcut notation for the HttpRuntime.AppDomainAppVirtualPath property, which, according to the .NET documentation, “returns the virtual path of the directory that contains the application hosted in the current application domain.” Another way to say it is that the ~ refers to the root of the virtual Web application, not the root of the Web server. The difference is subtle but crucial. It means that you can use a ~ to start the paths in your application and no matter where you move the application it will find the referenced files without problem.