Log Out button?

Topics: Controls, Themes
Nov 23, 2011 at 10:50 PM

Hi guys, I am having some problems with the authentication system used by blogengine.


I am an asp.net developer my self, but I usually use FormsAuthentication for this.


What I did was, I used a LoginStatus control, like so:


                    <asp:LoginStatus ID="LoginStatus" runat="Server" LoginText="Log in" LogoutText="Log out"
                        EnableViewState="false" LoginImageUrl="~/themes/MyTheme/img/LoginButton.jpg"
                        onloggingout="LoginStatus_LoggingOut" />

The login part works, but when I click log out, the page doesn't do anything. It just does a postback and return to the homepage.

I tried:

    protected void LoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)

But it doesnt work.

I must be doing something wrong here... please help :).


Nov 24, 2011 at 2:57 AM

You can use code from standard theme:

<a runat="server" id="aLogin" /

Then in the form behind:

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;

Nov 24, 2011 at 5:42 PM

Thanks man