views:

489

answers:

1

I am generating a return url link so when the user hits the close button on this page they return to this ReturnUrl.

ie 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 01 on the ReturnUrl parameter.

So to generate the ReturnUrl bit I'm currently using

Uri.EscapeDataString(Request.Url.AbsoluteUri)

As I dont have direct access to the uat environment I dont know what will definetly work until after a release cycle so if I can avoid getting it wrong the first time that would be helpful.

Looking at Request.Url in debug the possibilities I have

DnsSafeHost or Host

which could be used with

AbsolutePath or LocalPath or PathAndQuery

or I have

OriginalString

Or I maybe I could use the referer instead?

+1  A: 

PathAndQuery gives you a relative path with querystring vars so you don't have to worry about the extra '01' on the domain. Just deal with relative paths.

Out of curiosity, is your uat environment load balanced? It appears that your app is confused as to which domain it's responding on. This could(possibly) happen if a request hits a balanced server directly versus the load balance point or the load balancer forwards requests to machine-specific domain?

I would request info from your network admin. If you describe what you're doing in great detail, especially that your app sometimes believes it's responding on app-uat-01, they might see the issue right away.

Corbin March