Merging the Media Courtyard With an Existing ASP.NET Site
In order to take the Vectorlight CMS from the provided sample site and to integrate it with your existing ASP.NET site you must firstly ensure the following folders/files are copied to your existing ASP.NET website root:
App_CMS
Bin
cmsx.dll
cmsx.Modules.dll
ClientBin
SilverClient.xap
documents
images
Default.aspx
Global.asax (Partial)
Web.config (Partial)
Changing your Global.asax file
The following event handler must be added to your Global.asax file in order for the CMS to re-route page requests correctly:
protected void Application_BeginRequest(object sender, EventArgs e)
{
string newPath = cmsx.Manager.UrlManager.GetNewPath();
if (newPath.Length > 0)
{
HttpContext.Current.RewritePath(newPath);
}
}
Changing your Web.config file
There are several important parts that must be copied to your web.config.
Index Search Configuration
This is required to allow content to be indexed and searched:
<appSettings>
<add key="Lucene.Net.lockdir" value="~/App_CMS/search/" />
</appSettings>
SQL Server Connection String
This entry sets the database connection string, obviously you will change this to the connection details for your SQL Server instance.
<connectionStrings>
<add name="mainConnection" connectionString="Data Source=myServer;Initial Catalog=myDatabase; user id=sa;password=sa;" providerName="System.Data.SqlClient" />
</connectionStrings>
System.Web
The following needs to be added to the System.Web section of your Web.config:
<system.web>
<roleManager enabled="true" defaultProvider="SqlRoleManager">
<providers>
<add name="SqlRoleManager"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="mainConnection"
applicationName="MyApplication" />
</providers>
</roleManager>
<membership defaultProvider="myMembershipProvider">
<providers>
<add name="myMembershipProvider"
applicationName="myApplication"
connectionStringName="mainConnection"
enablePasswordReset="true"
enablePasswordRetrieval="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordAttemptWindow="5"
passwordStrengthRegularExpression=""
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="system/login.aspx"/>
</authentication>
<pages>
<controls>
<add tagPrefix="cmsx" namespace="cmsx" assembly="cmsx"/>
<add tagPrefix="cmsx" namespace="cmsx.Modules" assembly="cmsx.Modules"/>
</controls>
</pages>
</system.web>
Role Manager/Membership Adapter
This section configures the ASP.NET role provider. The Vectorlight CMS currently supports only SQL Server based membership
Authentication/Login Page
This sets The destination page that unauthorized users will be redirected to when they attempt to access a CMS page that they are not allowed to see.
Controls/Media Courtyard CMS DLL Registration
These two core CMS dlls must be registered here.
Setting Up Emails
In order for the emailing functionality to work you need to include the relevant mail server settings here.
<system.net>
<mailSettings>
<smtp from="mail@sample.com">
<network host="smtp.sample.com" userName="mail@sample.com" password="password" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
Important Note for ASP.NET Web Applications
This step is necessary when merging the CMS site with an ASP.NET Web Application (Web Site projects do not need this).
When including the provided files if you want to include the module user controls in your Visual Studio project you will need to convert each user control before your project will compile. To do this in Visual Studio using the Solution Explorer view simply right-click the user control and select Convert to Web Application.