Because you're using it directly in markup, rather than in a server control. Something as simple as this should fix it:
Login
Basically, the ~
path reference needs to be translated on the server, since it's a reference to the server path of the application's base directory. Plain HTML markup isn't processed on the server, it's just delivered as-is to the client. Only server-processed code will translate the ~
path to what it resolves to.