0

We have two virtual URL's that is using webseal for our intranet appication such as,

https://third-party-site.com/myapplication/Default.aspx
https://my-application.com/Default.aspx

which internally points to https://original-url.com:8080/Default.aspx after successful authentication from their respective sites.

I want to get the current URL from Default.aspx page. I have tried with Request.Url but it is returning the original URL. ie. https://original-url.com:8080/Default.aspx

For eg. if I access Default page from https://third-party-site.com/myapplication/ then it should return the current URL as https://third-party-site.com/myapplication/Default.aspx.

Currently it is returning as https://original-url.com:8080/Default.aspx

Is there any way to get the virtual URL itself?

DiluMaverick
  • 141
  • 1
  • 1
  • 9

1 Answers1

0

Request.Url returns https://original-url.com:8080/Default.aspx because this is what IIS receives. You don't describe your infrastructure but I believe you have load balancer or some kind of rouer before the IIS. It is often (de facto a standard) that those services inject http header called X-Forwarded-For. You can try get that by:

if (Request.Headers["X-Forwarded-For"].Count > 0) { ... // use the real domain }

If that fails you should check documentation of your service handling the requests before the IIS.