Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Created September 29, 2012 17:28
Show Gist options
  • Save Buildstarted/3804658 to your computer and use it in GitHub Desktop.
Save Buildstarted/3804658 to your computer and use it in GitHub Desktop.
Mvc Music Store Login Partial
@if (Request.IsAuthenticated) {
<text>
Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
@Html.AntiForgeryToken()
<a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
}
</text>
} else {
<ul>
<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