Categories
CMS Sitefinity Uncategorized

Ultimate Sitefinity Setup Guide: Part Two

This Guide

This guide is my ultimate guide to setting up Sitefinity.  I’ll be updating it as I find new things that I commonly do when I want to setup a new project.  Today, I’ll be going over common Visual Studio solution changes, Sitefinity Settings and more that I use on almost every project.

In Part One, I setup the base solution and continuous integration with Visual Studio Team Services.  This post will be more about actual settings in the Sitefinity project.

Storage Mode of Configurations

What is it?

Sitefinity has 4 separate configuration storage mechanisms that are explained pretty well in the documentation link.  The default mode is Auto Storage which means that environment based settings in the file system and application based settings are hosted in the database.  This mode is perfect for CI deployments as it allows application settings changes in multi-server environments and the environment settings should be settings that are rarely changed anyways.

On top of this, its possible to set remote servers configurations to Read-Only.  This is great because it prevents some users from accidentally making configuration settings that would cause your site to recycle.  It also prevents the server having changes that are not stored in source control.

To set all of this, you should add a web.config transform by right clicking on the web.config file and clicking the ‘Add Config Transform’.  Then find the transformation file you want to use and add the following code.

 <telerik>
 <sitefinity>
 <sitefinityConfig storageMode="Auto" restrictionLevel="ReadOnlyConfigFile" xdt:Transform="Replace"/>
 </sitefinity>
 </telerik>

Database Connection

Sitefinity by default stores its connection string in the DataConfig.config file found in the App_Data folder.  This makes multiple environment setups more difficult to maintain and prevents the ability to encrypt the connection string especially if there is a password field.  To accomplish this, do NOT delete the DataConfig.config but just remove the connection string line and add it to the web.config.

DataConfig.config

<?xml version="1.0" encoding="utf-8"?>
<dataConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="10.1.6502.0" initialized="True">
 <connectionStrings>
 </connectionStrings>
</dataConfig>

WebConfig.config

<connectionStrings>
 <add name="Sitefinity" connectionString="data source=XXXXXXXXXX;Integrated Security=True;;initial catalog=PublicWebsite" providerName="System.Data.SqlClient" />
 </connectionStrings>

Web.config Transform

<connectionStrings>
 <add name="local" connectionString="data source=XXXXXXXX;Integrated Security=True;;initial catalog=PublicWebsite" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
 </connectionStrings>

Login HTTPS Security

It’s super important to setup HTTPS security for the login and Sitefinity is not setup like this by default.  The great news is that it takes very little to do. Documentation

Web.config

<system.identityModel.services>
 <federationConfiguration>
 <wsFederation passiveRedirectEnabled="true" issuer="http://localhost" realm="https://localhost" requireHttps="true" />
 <cookieHandler requireSsl="false" />
 </federationConfiguration>
 </system.identityModel.services>

SecurityConfig.config

<securityTokenIssuers>
 <add key="" membershipProvider="Default" realm="http://localhost" />
 <add key="" membershipProvider="Default" realm="https://localhost" />
 <add key="" membershipProvider="Default" realm="https://www.example.com" />
 <add key="" membershipProvider="Default" realm="https://example.com" />
 </securityTokenIssuers>
 <relyingParties>
 <add key="" realm="http://localhost" />
 <add key="" realm="https://localhost" />
 <add key="" realm="https://www.example.com" />
 <add key="" realm="https://example.com" />
 </relyingParties>

Password Retrieval

While you’re in the SecurityConfig.config you should add your SMTP information for password recovery.  Here’s what it would look like

<membershipProviders>
 <add enablePasswordRetrieval="true" recoveryMailAddress="noreply@hmbnet.com" name="Default" config:flags="1" />
 </membershipProviders>

SMTP Settings

SystemConfig.config

<smtpSettings host="example.outlook.com" port="587" userName="noreply@example.com" password="XXXXX" />

ELMAH Setup

Sitefinity does a great job with the instructions for setting up ELMAH on their sites.  I’m just collecting everything here. Documentation

  1. Install ELMAH on SQL Server first
  2. Run added SQL script on Sitefinity database to create ELMAH stored procedures and tables.

SystemConfig.config

<uiElmahSettings isElmahLoggingTurnedOn="True" />

Web.config

Update your connection string

<add name="elmah-sqlserver" connectionString="data source=XXXXXXXX;Integrated Security=True;;initial catalog=XXXXXX" providerName="System.Data.SqlClient" />

Conclusion

A lot of the is the default options but once I tinkered with the above settings I was able to get this up in running in just a couple of hours.  I had zero experience with this before hand.  In part two, I will be describing listing out all of the Sitefinity settings that I feel should be automatically included and the way to set them up without running the solution.

 

 

 

 

 

 

By Brett The Whitt

Brett is a web development consultant and has been working for more than 12 years. He specializes in hybrid mobile app development and using front end frameworks such as AngularJS. Always passionate about continuous education, he has been most recently mentoring and encouraging his co-workers to become better speakers. To further this growth, he leads Lightning Talk Nights and other events at his job at HMB Inc

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s