How to set RequireSssl Property Programmatically from Master

Posted by Community Admin on 03-Aug-2018 14:47

How to set RequireSssl Property Programmatically from Master template

All Replies

Posted by Community Admin on 30-Mar-2011 00:00

What I'd like to do is (pseudo code from the master page template):

1.if (_forceSSL && (!Request.IsLocal) && (!Request.IsSecureConnection))
2.            
3.                //override sitefinity requireSSL checkbox in admin   
4.                Page.RequireSsl = true; //HOW DO I DO THIS?
5.  
6.                //redirect page
7.                Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
8.            

Line 4. is what I'm stuck on. I don't know how to access the sitefinity property from inside the master page c# code.

I looked at other forum threads and I figure it has something to do with the PageData object, but I don't know how to instantiate that with the correct page id from my master page. I'm using SF 4.0 and I believe we have the latest service pack installed.

Thanks in advance for your help!

Ben Barreth

Posted by Community Admin on 18-Apr-2011 00:00

Hi Ben,

You should work with PageData object and its RequireSsl property. PageData stores the page information/data for each PageNode. You can get a page node using the fluent or standard API.
After you set the RequireSsl property you should call SaveChanges() method of the PageManager ( if you use the standard API or SaveChanges() from the fluent facade)

Kind regards,
Ivan Dimitrov
the Telerik team


This thread is closed