user2739418
user2739418

Reputation: 1631

How to access BetterCMS Admin page

I successfully setup BetterCMS in my ASP.NET MVC application with the help of following link:

http://www.devbridge.com/articles/better-cms-for-developers/

I can view following page now: enter image description here

How I can see Admin section now? Tx.

Upvotes: 2

Views: 998

Answers (4)

Sameer
Sameer

Reputation: 383

Replace your Global.asax with the below code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using System.Security.Principal;
using BetterCms.Core;
using BetterCms.Core.Environment.Host;
using TestingCms.App_Start;


namespace TestingCms
{
    public class MvcApplication : System.Web.HttpApplication
    {
        private static ICmsHost cmsHost;
        protected void Application_Start()
        {
            cmsHost = CmsContext.RegisterHost();

        /* DO NOT FORGET TO REMOVE DEFAULT ROUTE REGISTRATION! 
           FOLLOWING SOURCE CODE SHOULD BE REMOVED: 

           routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        */

        // [YOUR CODE]  

        cmsHost.OnApplicationStart(this);
    }

    protected void Application_BeginRequest()
    {
        // [YOUR CODE]

        cmsHost.OnBeginRequest(this);
    }

    protected void Application_EndRequest()
    {
        // [YOUR CODE]

        cmsHost.OnEndRequest(this);
    }

    protected void Application_Error()
    {
        // [YOUR CODE]

        cmsHost.OnApplicationError(this);
    }

    protected void Application_End()
    {
        // [YOUR CODE]

        cmsHost.OnApplicationEnd(this);
    }

    protected void Application_AuthenticateRequest(object sender, EventArgs e)
    {
        // [YOUR CODE]

        // Uncomment following source code for a quick Better CMS test if you don't have implemented users authentication. 
        // Do not use this code for production!

        var roles = new[] { "BcmsEditContent", "BcmsPublishContent", "BcmsDeleteContent", "BcmsAdministration" };
        var principal = new GenericPrincipal(new GenericIdentity("TestUser"), roles);
        HttpContext.Current.User = principal;


        cmsHost.OnAuthenticateRequest(this);
    }

}
}

Upvotes: 0

Darsana
Darsana

Reputation: 1

Just comment the "Route config" method in global.ascx.cs file. similarly to do for the below code in RouteConfig file,comment the register path.

To get Admin settings , just the below model in your main layout page

@{
    Layout = "~/Areas/bcms-Root/Views/Shared/BaseLayout.cshtml";
}

Upvotes: 0

Dan Beaulieu
Dan Beaulieu

Reputation: 19954

I'm sure you figured this out by now, but to make this post useful for others all you need to do is put /login after your localhost adress.

like this: localhost:50720/login

Upvotes: 2

Nguyen Giap
Nguyen Giap

Reputation: 1

You recheck file at : "App_Start/RouteConfig.cs". You config same below :`

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //routes.MapRoute(
            //    name: "Default",
            //    url: "{controller}/{action}/{id}",
            //    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            //);
        }`

Upvotes: 0

Related Questions