Set Require SSL to true for new pages

Posted by Community Admin on 03-Aug-2018 18:31

Set Require SSL to true for new pages

All Replies

Posted by Community Admin on 15-May-2017 00:00

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

 

 

Posted by Community Admin on 29-Jun-2017 00:00

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);
        
    

This thread is closed