Uri.EscapeDataString (Request.Url.AbsoluteUri) is wrong in different environments, what else should I use?
I am creating a backlink url so when the user clicks the close button on this page they go back to that return.
This works fine in dev environment, but in uat environment I have
Notice the extra parameter 01 in the ReturnUrl parameter.
So, to generate the ReturnUrl bit, I am currently using
Uri.EscapeDataString (Request.Url.AbsoluteUri)
Since I don't have direct access to the uat environment, I don't know what will definitely work until after the release cycle if I can avoid misusing it the first time it's useful.
Looking at Request.Url in debugging capabilities I have
DnsSafeHost or Host
which can be used with
AbsolutePath or LocalPath or PathAndQuery
or me
OriginalString
Or maybe I could use a referee?
source to share
PathAndQuery gives you a relative path with querystring vars, so you don't have to worry about the extra "01" in the domain. Just use relative paths.
Out of curiosity, is the load balance on Uat balanced? It looks like your application is confused as to which domain it is responding to. Can this happen if the request hits the balanced server directly to the load balance point, or the load balancer forwards requests to a machine-specific domain?
I would ask your network administrator for information. If you describe in detail what you are doing, especially that your application sometimes thinks it is responding to app-uat-01, they can see the problem right away.
source to share