Your problem is that # specified an anchor in the page, so the browser sees:
http://localhost/site/page.aspx?var=1&var=2
And then looks in the page for
<a name="link">anchor</a>
As this is client side you need to escape the # from the URL - you can't get it on the server because the browser's already stripped it off.