Last active
November 6, 2017 04:50
-
-
Save b-tiwari/5279321149a86e98d6ffdf7dbe22b502 to your computer and use it in GitHub Desktop.
_loginPartial.cshtml - Claims based identity in MVC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @using Microsoft.AspNet.Identity | |
| @if (Request.IsAuthenticated) | |
| { | |
| using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) | |
| { | |
| @Html.AntiForgeryToken() | |
| <ul class="nav navbar-nav navbar-right"> | |
| <li> | |
| @Html.ActionLink("Hello " + @appUserClaims.GivenName + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" }) | |
| </li> | |
| <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li> | |
| </ul> | |
| } | |
| } | |
| else | |
| { | |
| <ul class="nav navbar-nav navbar-right"> | |
| <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> | |
| <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li> | |
| </ul> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment