Tilde showing in URL instead of mapping to root
We have a old .net site that runs on the 2.0 framework. In this site there are multiple calls that redirect when needed by calling response.redirect(). For some reason that I cannot figure out the ` character has stopped being mapp开发者_如何学运维ed to the root - and is actualy showing as part of the path. For example:
Response.Redirect("~/shopping/checkout_confirm.aspx?rc=" &
MyPayment.ResponseCode & "&rt=" & MyPayment.ResponseText)
Now ends up trying to redirect to:
https://www.site.com/shopping/~/shopping/checkout_confirm.aspx?rc=3
I have tried the following aswell, with no luck:
Response.Redirect(Page.ResolveUrl("~/shopping/checkout_confirm.aspx?rc=" &
MyPayment.ResponseCode & "&rt=" & MyPayment.ResponseText))
When run in the dev environment the url maps correctly... Any idea's on what could be the cause / fix for this problem?
Part of the ResponseText contained a character that needed to be encoded.
Try using a relative path instead:
Response.Redirect("checkout_confirm.aspx?rc=" & MyPayment.ResponseCode & "&rt=" & MyPayment.ResponseText)
精彩评论