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.

those. http: // localhost: 42605 / Search.aspx? ReturnUrl = http% 3A% 2F% 2Flocalhost% 3A42605% 2FStuff% 2FViewStuff.aspx% 3FProjectId% 3D2246

This works fine in dev environment, but in uat environment I have

http://app-uat.com/Search.aspx?ReturnUrl=http%3A%2F%2Fapp-uat-01.com%2FStuff%2FViewStuff.aspx%3FProjectId%3D2246

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?

0


source to share


1 answer


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.

+1


source







All Articles