I hope I've understood your question correctly, but please do let me know if I haven't.
I notice that you use ~/ . This would resolve and write the entire URL to the response I think. It is better to use only / when writing links to the response.
It sounds like the sole issue you have is that when you write the links to the response they sometimes reference the wrong root URL.
So in your example you would write /myfolder/mypage.aspx. The browser would then resolve the / to mean that it's from the root address of the site, whichever that may be.
Thanks for commenting "The Bearded Llama" :) - Your suggestion is only a work-around. I am able to resolve my links in a similar way, but I am more interested on figuring out why IIS is doing this and how to prevent it, rather then working around it. I've add URL rewrites to help with the issue, but I sure wish I knew how to prevent it.
Well, it's not really a workaround, it's more keeping with DRY as well as not hardcoding things. Although, now I understand what your question was about. It sounds like it's an IIS setup issue. If you post your IIS setup, I'll be more than happy to have a look and try to help.