0

When my MVC4 web site (mywebsite.com) is deployed (to Amazon Web Services) and a non-authenticated user clicks on a link requiring authentication (e.g. Search), they are redirected to

www.mywebsite.com/Web.UI_deploy/Account/Login?ReturnUrl=%2fSearch

instead of

www.mywebsite.com/Account/Login?ReturnUrl=%2fSearch

(Web.UI_deploy is the web root on the web server). This issue only occurs with deployment, not on localhost.

What is the cleanest method of resolving this?

1 Answer 1

1

Minor change in the web.config solves the issue

Before

<authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>

I removed the tilde ~ and it solved the problem

After

<authentication mode="Forms">
      <forms loginUrl="/Account/Login" timeout="2880" />
</authentication>

I got this idea from Issue with return URL Authorize issue MVC4

Sign up to request clarification or add additional context in comments.

1 Comment

can you provide what your original web.config looked like in the original post? This will help anybody else if they experience the same problem. Your answer may have helped resolve your issue, but doesn't help another user later

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.