2

I have an ASP.NET application. As well as local users accessing the application directly, I want to expose it to external users through a reverse proxy (which is running on a different machine in the DMZ)

for example, say internal users use the URL http://intranet1/myApplication/default.aspx, external users might use the URL http://www.mycompany.com/externalApplication/default.aspx

this is quite simple to set up with URL rerwiting, but there is a problem when forms authentication is turned on. if an external user hits the URL site, forms auth tries to automatically send them to the login page which redirects them to the relative url /myApplication/LoginPage.aspx. as far as the web app is concerned, the application root is at /myApplication not /externalApplication. Of course the external user coming in through the firewall does not understand this URL so the request fails with a 404

is there a sensible solution for this?

1
  • How did you resolve this ? please take a look at here Commented Sep 2, 2019 at 12:46

1 Answer 1

2

You should not redirect to "/myApplication/LoginPage.aspx" but to "~/Login.aspx", so it would be correctly mapped depends on which URL is user hits on.

<authentication mode="Forms">
  <forms loginUrl="~/Login.aspx" timeout="2880" />
</authentication>
Sign up to request clarification or add additional context in comments.

4 Comments

It also wouldn't hurt to have the application defined as the same folder on both servers.
Thanks alexanderb, That's exactly what I was looking for. I had completely forgotten that the URL was configurable in the web.config.
Hmm, I've had another think about that. Surely your suggestion is no different to my original configuration (loginurl="/MyApplication/default.aspx") because the ~ will be converted to /MyApplication before the redirect is sent to the browser
no, it actually sure re-direct to externalApplication/login.aspx if rest URL rerwiting is ok :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.