We have a web-based application that uses Response.Redirect
e.g. Response.Redirect("http://app_domain.com/userhome.aspx")
to redirect the web-browser to an appropriate home page right after form-based authentication. This works fine when the client and server are on the same network.
We have a use-case where this application needs to be accessed externally via a reverse proxy (we're using EZProxy). So the web-browser connects to the reverse proxy and the reverse proxy connects to the application server. In this case, the reverse proxy re-writes all requests and responses. The URL in the web-browser's address bar is something like http://app_domain.com.reverseproxy.com/. The user is able to browser to the sign-in page, put in the credentials and click the sign-in button. However, it seems that the Response.Redirect right after successful sign-in breaks the flow by redirecting the browser to http://app_domain.com/userhome.aspx. The browser cannot connect to this domain directly because it is behind a firewall.
This question is similar to Response.Redirect in ASP.NET AJAX calls. However I see that question doesn't have a satisfactory answer.
Is it possible to use relative paths like
Request.Redirect("~/Userhome.aspx")
or does that get resolved on the server-side before passing to the browser?
The desired outcome would be a redirection mechanism that would take into account the domain / url present in the web-browsers address bar.
Using fiddler, this is what I see. That last redirect is not reverse-proxy friendly.
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: text/plain; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.0
Set-Cookie: .ASPXAUTH=BE3D7796245FEEA18FF92C9BD4B3F68F08C9E22CA209A139FBDC45BD6633788E6E68EE30F2BAE7EB223CA8F492FA93DFE7AB2723A848C6E75DF87B613075AF418D517921E81B2741224D702B9; path=/; HttpOnly
Set-Cookie: .ASPXAUTH=693B8AC69ABB53F7468466C6D10C9BF5BAFB860F76FC557E3DAD9C733223957E3A46FF8E21E6822CD5420F1724C61809DC83FDE7C8E3DF9D4E972E61F7DDEE05C61E8D8AA97107B5B68412AFC347; path=/; HttpOnly
X-Powered-By: ASP.NET
Date: Fri, 15 Jun 2012 20:41:32 GMT
Content-Length: 64
46|pageRedirect||http://app_domain.com/UserHome.aspx|