Jay
Jay

Reputation: 89

Sitecore Admin Page using MVC

I'd like to create a page where I can login using sitecore users, something similar to what the admin pages do. But I want it to be MVC not Webforms/ASPX, is that possible? if yes, How?

Thanks in advance.

Upvotes: 1

Views: 738

Answers (1)

Marek Musielak
Marek Musielak

Reputation: 27132

Sitecore Admin pages are like any other pages. The only thing the do before displaying content to the user, is a security check:

protected void CheckSecurity(bool isDeveloperAllowed)
{
    if (Context.User.IsAdministrator)
    {
        return;
    }
    if (isDeveloperAllowed && this.IsDeveloper)
    {
        return;
    }
    SiteContext site = Context.Site;
    if (site != null)
    {
        base.Response.Redirect(string.Format("{0}?returnUrl={1}", site.LoginPage, HttpUtility.UrlEncode(base.Request.Url.PathAndQuery)));
    }
}

So if you want to create MVC page allowed only to logged in users, make sure that you include a call to that method.

Upvotes: 1

Related Questions