I have this code:
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
</head>
<body>
<div id="header">
<div id="header-inside">
<div id="logo"></div>
<div id="top-menu">
<a href="#">Home</a> | <a href="#">About</a> | <a href="#">Contact</a> |
</div>
</div>
</div>
<div id="content">
@RenderBody()
</div>
</body>
</html>
I want to add a login button there that will detect whether or not the user is logged in, and if the user is it will turn into “logout”. I am using Membership Services so I would use MembershipUser
If you have your
Requestobject you can useRequest.IsAuthenticated(MSDN docs here) which will work regardless of how you manage your users behind the scenes, as long as it plugs into the system ASP .NET provides.Example: