How To Remove "Log In" link from BlogEngine.Net Sites



TODO:

Have you ever wanted to get rid of the "log in" link that appears on sites created with BlogEngine.Net?

 

SOLUTION:

1.  Edit the PageMenu.cs page that is located in BlogEngine.Net\App_Code\Controls\PageMenu.cs

2.  Chagne the BindPages() method to be the code below.

3.  Build BlogEngine.Net, and copy the DLLs to your "bin" folder.

 

private HtmlGenericControl BindPages()
{
            // recursivly get all children of the root page
            HtmlGenericControl ul = GetChildren(Guid.Empty);

            // items that will be appended to the end of menu list
            AddMenuItem(ul, Contact, "~/contact.aspx");

            if (Security.IsAuthenticated)
            {
                AddMenuItem(ul, Logoff, "~/Account/login.aspx?logoff");
            }
            else
            {
                //AddMenuItem(ul, Logon, "~/Account/login.aspx");
            }

            return ul;
}

 

 

NOTES:

All I did was comment out the else so that "log in" never appears.  If you navigate to http://site/account/login.aspx, you can log in.  In the event you do log in, you will get a "log out" link, but will never get the "log in" link.



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading