Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Submitting of _Logout partial view does not work.

$
0
0

Hello.

I am trying to have a logout button on mu _Layout, but i have some problems!

1. When i don't use partial views and simply insert my code to _Layout it does not work :

<div>
<form asp-action="Logout" asp-controller="Account"><input type="submit" class="btn" value="Logout"/></form>
2. When i want to use partial views although it does not work :</div> <div>above code in _Logout.cshtml and in _Layout.cshtml : @Html.Partial("_Logout")</div> <div></div> <div>and my Logout method :</div> <div>
[HttpPost]
        public async Task<IActionResult> Logout()
        {
                await _signInManager.SignOutAsync();
                return View("Home","Index");
        } 
i don't have GET method for logout, just HttpPost method i have.</div> <div>When i click on button it navigates to : /Account/Logout</div> <div>and it shows 404 error</div> <div>How can i invoke Post method by submitting form? actually how should i implement logout??? i saw default project and i copied all codes but no result :-(</div>

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>