This project is read-only.

Adding the admin login/log off link

Topics: Controls, Themes
Jun 13, 2013 at 2:43 PM
I'm creating some new custom blog themes and I'm having some difficulty adding a link for admins to login to the blog. Based off of the currently existing/prepackaged blog themes, I've added the following to my page:
<div class="login" >
    <span runat="server" id="aUser"></span><a runat="server" id="aLogin" />
But nothing shows up. What's actually rendered on the page:
<div class="login" >
    <span id="ctl00_aUser"></span><a id="ctl00_aLogin"></a>
An empty link with no text and no href. Am I missing something super obvious here? How can I add login links for blog admins?
Jun 13, 2013 at 3:31 PM
You missing code-behind part (site.master.cs). In the Page_Load:
if (Security.IsAuthenticated)
    aLogin.InnerText = Resources.labels.logoff;
    aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx?logoff";
    aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx";
    aLogin.InnerText = Resources.labels.login;
Jun 13, 2013 at 3:45 PM
Derp. That fixed it. For anyone else with this problem, you also need to add a using BlogEngine.Core; directive to your page.