0

when I call a different controller from an area, it does not remove the area name from the url.

ex -

http://localhost:1395/Syndicate/Home

here "syndicate" is my area. when I call another action from main project (outside the area) through <a href="/Login/Logout"> it still remains "syndicate" in the url.

ex -

http://localhost:1395/Syndicate/Login/Logout

how can I avoid this problem ?

I tried @Html.ActionLink("Log out", "LogOut", "Login", new { area = "" }, null) this but didn't work

Ravi Rajindu
  • 380
  • 2
  • 6
  • 23
  • What you do seems right, both in my experience and also according to this answer: http://stackoverflow.com/a/3756992/1220550 The answer also gives guidance about using T4MVC which will help avoid this kind of problems and which I can certainly recommended. – Peter B Oct 24 '16 at 13:05

1 Answers1

0
 function Logout() {
            window.location.href = '@Url.Action("Logout", "Login", new { area = string.Empty },null)';
        }

just call this javascript function from anchor onclick,

Prasanna Kumar J
  • 1,288
  • 3
  • 17
  • 35