More in this section

Forums / General Discussions / Set Require SSL to true for new pages

Set Require SSL to true for new pages

2 posts, 0 answered
  1. Chance
    Chance avatar
    3 posts
    Registered:
    24 Apr 2015
    15 May
    Link to this post

    Is it possible to default  that 'Require SSL' checked to true for newly created pages?

     

     

  2. Brett Whittington
    Brett Whittington avatar
    33 posts
    Registered:
    12 Jan 2012
    29 Jun
    Link to this post

    Yes, this is possible but not through any configuration setting unless it was recently added.  I have some documentation on how to do this. The negative is you have to replace this every time you update Sitefinity.  This code is from Sitefinity 8 but I don't see why it would not work for 10.  These instructions are below.

    Automatically setting pages to SSL requires a custom page service.  This custom service overrides the default page service and sets the RequireSSL attribute to true. To implement this functionality the following code must be inserted into the SitefinityWebApp solution

    • Below the above code file into the root of the SitefinityWebApp solution
    • Navigate to and open PageService.svc found in /Sitefinity/Sevices/Pages/
    • Replace the text in the service parameter
      • Replace <%@ ServiceHost Language="C#" Debug="false" Service="Telerik.Sitefinity.Modules.Pages.Web.Services.PagesService" Factory="Telerik.Sitefinity.Web.Services.WcfHostFactory" %>
      • With <%@ ServiceHost Language="C#" Debug="false" Service="SitefinityWebApp.Services.SSLPageService" Factory="Telerik.Sitefinity.Web.Services.WcfHostFactory" %>

     

    using Telerik.Sitefinity.Modules.Pages.Web.Services;
    using Telerik.Sitefinity.Modules.Pages.Web.Services.Model;
     
    namespace SitefinityWebApp.Services
    {
        public class SSLPageService : PagesService, IPagesService
        {
            public new WcfPageContext SavePage(WcfPageContext pageContext, string pageId, string providerName, bool duplicate)
            {
                pageContext.Item.RequireSsl = true;
                return base.SavePage(pageContext, pageId, providerName, duplicate);
            }
        }
    }

2 posts, 0 answered