<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">Blog posts by Erik Engstrand</title><link href="http://world.optimizely.com" /><updated>2015-09-16T08:27:00.0000000Z</updated><id>https://world.optimizely.com/blogs/Erik-Engstrand/</id> <generator uri="http://world.optimizely.com" version="2.0">Optimizely World</generator> <entry><title>Create empty database in EPiServer 8</title><link href="http://erikengstrand.blogspot.com/2015/09/create-empty-database-in-episerver-8.html" /><id>&lt;until a=&quot;&quot; br=&quot;&quot; center.=&quot;&quot; clean=&quot;&quot; create=&quot;&quot; database=&quot;&quot; deployment=&quot;&quot; episerver=&quot;&quot; from=&quot;&quot; i=&quot;&quot; it=&quot;&quot; possible=&quot;&quot; recently=&quot;&quot; to=&quot;&quot; was=&quot;&quot;&gt;&lt;/until&gt;&lt;div&gt;Since I started with Windows 8 my Deployment Center doesn&#39;t work anymore. Even after trying the &lt;a href=&quot;http://dotnetcake.blogspot.se/2012/06/installing-episerver-6-r2-on-windows-8.html&quot;&gt;regedit fix&lt;/a&gt;.&lt;/div&gt;&lt;h2&gt;Cmdlet Initialize-EPiDatabase&lt;/h2&gt;&lt;div&gt;Since EPiServer version 8,8 a cmdlet &quot;Initialize-EPiDatabase&quot; is shipped with the nuget package EPiServer.Framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When running this command in Package Manager Console in Visual Studio an .mdf file with the database will be created in the App_Data folder. If you want to run the database on a remote server just place the .mdf and .ldf files on in the SQL Server data\ folder and run the &quot;Attach&quot; command in Management Studio.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But, there is a catch! The mdf database is created with the version of SQL you are running on your local computer. It&#39;s then impossible to attach the database to an older version.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will get something like this error message:&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;The database cannot be opened because it is version 782. This server supports version 706 and earlier.&lt;/blockquote&gt;&lt;h2&gt;Create the databse directly on the remote SQL Server&amp;nbsp;&lt;/h2&gt;&lt;div&gt;After som digging and also asking EPiServer I found that Initialize-EPiDatabase is capable to create a database on a remote server.&lt;/div&gt;&lt;div&gt;Open the file&amp;nbsp;\packages\EPiServer.Framework.8.10.1\tools\Upgrade.psm1 and search for &quot;Function Initialize-EPiDatabase&quot;. You will find some useful documentation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;    .Description&lt;br /&gt;  Deploy all sql schema that can be found under nuget package. The pattern to find sql files is nugetpackage.id.version\tools\nugetpackage.id.sql.&lt;br /&gt;  By default uses EPiServerDB connection string name and if the connection string name is different from default (EPiServerDB)&lt;br /&gt;  then it needs a settings.config as: &lt;br /&gt;  &lt;settings&gt;&lt;br /&gt;   &lt;connectionstringname&gt;MyConnectionString&lt;/connectionstringname&gt;&lt;br /&gt;  &lt;/settings&gt;&lt;br /&gt;    .SYNOPSIS &lt;br /&gt;  Deploy epi database schema.&lt;br /&gt;    .EXAMPLE&lt;br /&gt;  Initialize-EPiDatabase&lt;br /&gt;  This command deploy all epi database schema that can be found in the nuget packages. &lt;br /&gt; .EXAMPLE&lt;br /&gt;  Initialize-EPiDatabase -sqlFilePattern:c:\data\mysql.sql -connectionString:MyConnectionString&lt;br /&gt;  This command deploy mysql.sql into database by using MyConnectionString. The -connectionString can be both connection string name inthe application web config or connection string.&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;The way I used Initialize-EPiDatabase to create a database on a remote SQL Server was to:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create an empty database on the SQL Server&lt;/li&gt;&lt;li&gt;In Web.config have a proper connectionstring named EPiServerDB which points to your empty database.&lt;/li&gt;&lt;li&gt;Run&amp;nbsp;Initialize-EPiDatabase in Package Manager Console&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;One more catch. The cmdlet Initialize-EPiDatabase did not work in Visual Studio 2015 and nuget Package Manager version 3.1.60724.766. It worked in Visual Studio 2013.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Error message in VS 2015 (something wrong with detection of packed folders):&lt;/div&gt;&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;copy-Item : Cannot find path &#39;C:\projects\Borlange.se\Main\Source\Borlange\packages\EPiServer.Framework.8.0.0\EPiServer.Framework.8.0.0\tools\epidepl&lt;br /&gt;oy.exe&#39; because it does not exist.&lt;br /&gt;At C:\projects\Borlange.se\Main\Source\Borlange\packages\EPiServer.Framework.8.0.0\tools\upgrade.psm1:157 char:2&lt;br /&gt;+     copy-Item $epiDeployPath  -Destination $exportRootPackageName&lt;br /&gt;+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;    + CategoryInfo          : ObjectNotFound: (C:\projects\Bor...s\epideploy.exe:String) [Copy-Item], ItemNotFoundException&lt;br /&gt;    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;</id><updated>2015-09-16T08:27:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Create clean empty database in EPiServer 8</title><link href="http://erikengstrand.blogspot.com/2015/09/create-empty-database-in-episerver-8.html" /><id>&lt;until a=&quot;&quot; br=&quot;&quot; center.=&quot;&quot; clean=&quot;&quot; create=&quot;&quot; database=&quot;&quot; deployment=&quot;&quot; episerver=&quot;&quot; from=&quot;&quot; i=&quot;&quot; it=&quot;&quot; possible=&quot;&quot; recently=&quot;&quot; to=&quot;&quot; was=&quot;&quot;&gt;&lt;/until&gt;&lt;br /&gt;&lt;div&gt;Since I started with Windows 8 my Deployment Center doesn&#39;t work anymore. Even after trying the &lt;a href=&quot;http://dotnetcake.blogspot.se/2012/06/installing-episerver-6-r2-on-windows-8.html&quot;&gt;regedit fix&lt;/a&gt;.&lt;/div&gt;&lt;h2&gt;Cmdlet Initialize-EPiDatabase&lt;/h2&gt;&lt;div&gt;Since EPiServer version 8,8 a cmdlet &quot;Initialize-EPiDatabase&quot; is shipped with the nuget package EPiServer.Framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When running this command in Package Manager Console in Visual Studio an .mdf file with the database will be created in the App_Data folder. If you want to run the database on a remote server just place the .mdf and .ldf files on the SQL Server data\ folder and run the &quot;Attach&quot; command in Management Studio.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But, there is a catch! The mdf database is created with the version of SQL you are running on your local computer. It&#39;s then impossible to attach the database to an older version.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You will get something like this error message:&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;The database cannot be opened because it is version 782. This server supports version 706 and earlier.&lt;/blockquote&gt;&lt;h2&gt;Create the database directly on the remote SQL Server&amp;nbsp;&lt;/h2&gt;&lt;div&gt;After som digging and also asking EPiServer I found that Initialize-EPiDatabase is capable of creating a database on a remote server.&lt;/div&gt;&lt;div&gt;Open the file&amp;nbsp;\packages\EPiServer.Framework.8.10.1\tools\Upgrade.psm1 and search for &quot;Function Initialize-EPiDatabase&quot;. You will find some useful documentation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;    .Description&lt;br /&gt;  Deploy all sql schema that can be found under nuget package. The pattern to find sql files is nugetpackage.id.version\tools\nugetpackage.id.sql.&lt;br /&gt;  By default uses EPiServerDB connection string name and if the connection string name is different from default (EPiServerDB)&lt;br /&gt;  then it needs a settings.config as: &lt;br /&gt;  &lt;settings&gt;&lt;br /&gt;   &lt;connectionstringname&gt;MyConnectionString&lt;/connectionstringname&gt;&lt;br /&gt;  &lt;/settings&gt;&lt;br /&gt;    .SYNOPSIS &lt;br /&gt;  Deploy epi database schema.&lt;br /&gt;    .EXAMPLE&lt;br /&gt;  Initialize-EPiDatabase&lt;br /&gt;  This command deploy all epi database schema that can be found in the nuget packages. &lt;br /&gt; .EXAMPLE&lt;br /&gt;  Initialize-EPiDatabase -sqlFilePattern:c:\data\mysql.sql -connectionString:MyConnectionString&lt;br /&gt;  This command deploy mysql.sql into database by using MyConnectionString. The -connectionString can be both connection string name inthe application web config or connection string.&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;The way I used Initialize-EPiDatabase to create a database on a remote SQL Server was to:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create an empty database on the SQL Server&lt;/li&gt;&lt;li&gt;In Web.config have a proper connectionstring named EPiServerDB which points to your empty database.&lt;/li&gt;&lt;li&gt;Run&amp;nbsp;Initialize-EPiDatabase in Package Manager Console&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;One more catch. The cmdlet Initialize-EPiDatabase did not work in Visual Studio 2015 and nuget Package Manager version 3.1.60724.766. It worked in Visual Studio 2013.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Error message in VS 2015 (something wrong with detection of packege folders):&lt;/div&gt;&lt;pre class=&quot;language-csharp&quot;&gt;&lt;code&gt;copy-Item : Cannot find path &#39;C:\projects\Borlange.se\Main\Source\Borlange\packages\EPiServer.Framework.8.0.0\EPiServer.Framework.8.0.0\tools\epidepl&lt;br /&gt;oy.exe&#39; because it does not exist.&lt;br /&gt;At C:\projects\Borlange.se\Main\Source\Borlange\packages\EPiServer.Framework.8.0.0\tools\upgrade.psm1:157 char:2&lt;br /&gt;+     copy-Item $epiDeployPath  -Destination $exportRootPackageName&lt;br /&gt;+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;    + CategoryInfo          : ObjectNotFound: (C:\projects\Bor...s\epideploy.exe:String) [Copy-Item], ItemNotFoundException&lt;br /&gt;    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;</id><updated>2015-09-16T08:27:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Custom rendering of EPiServer.Url image property with figcaption</title><link href="http://erikengstrand.blogspot.com/2013/11/custom-rendering-of-episerverurl-image.html" /><id>I&#39;m back blogging after some years of absense. Let&#39;s see if I&#39;ll continue.&lt;br /&gt;For some time I have been developing a new EPiServer 7 CMS site in ASP.NET MVC. I got stuck into a problem last week. I tried the forum, but no answer!&amp;nbsp;&lt;a href=&quot;http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=77240&amp;amp;epslanguage=en&quot;&gt;http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=77240&amp;amp;epslanguage=en&lt;/a&gt;&lt;br /&gt;&lt;h2&gt;The problem&lt;/h2&gt;&lt;div&gt;I had an Url-property for images in my page type. The property was marked with [UIHint(UIHint.Image)]. The display template Image.cshtml rendered the image nicely.&amp;nbsp;&lt;/div&gt;&lt;div&gt;But, I wanted to render the Image with some extra functionality:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;A Css classon the img-tag.&lt;/li&gt;&lt;li&gt;Image caption, text fetched from the file summary of the EPiServer image file. This caption should be inside the property to be edited in edit mode.&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;First test&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;Code placed right in the page view, adding EditAttributes to tell EPiServer that the whole &lt;figure&gt; tag will be clickeable to edit the property.&lt;/figure&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;figure tml.editattributes=&quot;&quot; x=&quot;&quot;&gt; x.CurrentPage.Image)&amp;gt;&lt;/figure&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; @Html.DisplayFor(x =&amp;gt; x.CurrentPage.Image, new {CssClass = &quot;img-responsive&quot;})&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; @if (!string.IsNullOrEmpty(@Model.CurrentPage.Image.GetFileSummary().Description))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;figcaption&gt;@Model.CurrentPage.Image.GetFileSummary().Description&lt;/figcaption&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;A display template Image.cshtml&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;@model EPiServer.Url&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;lt;img src=&quot;@Model.Path&quot; class=&quot;@ViewData[&quot;CssClass&quot;]&quot; /&amp;gt;&lt;/div&gt;&lt;div style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The GetFileSummary extension&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static FileSummary GetFileSummary(this Url url)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var summary = new FileSummary();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (url != null)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var file = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(HttpUtility.UrlDecode(url.ToString())) as UnifiedFile;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (file != null)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var description = file.Summary.Dictionary[&quot;Description&quot;];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; summary.Description = description != null ? description.ToString() : &quot;&quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; summary.Title = file.Summary.Title;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return summary;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;div&gt;public class FileSummary&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string Description { get; set; }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string Title { get; set; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This looks right att the first glance, but in edit-mode when editing the property the css class dissappears.&lt;/div&gt;&lt;h2&gt;The solution&lt;/h2&gt;&lt;div&gt;To solve this I will create a new display template which will render the whole &lt;figure&gt; with caption.&lt;/figure&gt;&lt;/div&gt;&lt;div&gt;In the page view I add a Html.ProertyFor to take care of the whole rendering. The Image view including image caption will the be rerendered when editing the property.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;@Html.PropertyFor(x =&amp;gt; x.CurrentPage.Image, new { CssClass = &quot;img-responsive&quot; })&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Create a new image display template named ImageWithCaption.cshtml&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;@model EPiServer.Url&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;figure&gt;&lt;/figure&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;img src=&quot;@Model.Path&quot; class=&quot;@ViewData[&quot;CssClass&quot;]&quot; /&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; @if (!string.IsNullOrEmpty(@Model.GetFileSummary().Description))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;figcaption&gt;@Model.GetFileSummary().Description&lt;/figcaption&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;To tell EPiServer that the property will be rendered with this display template &quot;ImageWithCaption&quot; mark the property in the model like this:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;UIHint(&quot;ImageWithCaption&quot;)]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;public virtual Url Image { get; set; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;One problem left, when cliking to edit the property the wrong dialog for Url will show.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;By adding a second attribute to the property we will tell EPiServer to use the Image dialog in the presentation layer = edit mode instead of the classic Url dialog.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;UIHint(&quot;ImageWithCaption&quot;)]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;UIHint(UIHint.Image, PresentationLayer.Edit)]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;virtual&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Url Image { get; set; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;h2&gt;One problem still left, the caption don&#39;t update&lt;/h2&gt;&lt;div&gt;If I edit the property and click to open the dialog for choosing a file in the EPiServer file manager and then change the description by right clicking the file and edit file summary. The rendered image caption will not update! I don&#39;t know if it is possible to solve without adding an ugly FullRefreshPropertiesMetaData. Help if you know.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</id><updated>2013-11-21T10:31:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Subscription job deadlock on site with large number of users</title><link href="https://world.optimizely.com/blogs/Erik-Engstrand/Dates/2010/2/Subscription-job-deadlock-on-site-with-large-number-of-users/" /><id>&lt;p&gt;On web sites with large number of users you may get a deadlock in the SQL-server when executing the EPiServer subscription job.&lt;/p&gt;  &lt;p&gt;The error message is something like this: &lt;strong&gt;Exception has been thrown by the target of an invocation. [Transaction (Process ID 105) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.]&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/d134a235dcd1449c989f5280e94fa277.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/c321c42f30914a72884b10bc51b22f41.png&quot; width=&quot;567&quot; height=&quot;77&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h2&gt;Cause of the error&lt;/h2&gt;  &lt;p&gt;The error comes from the SQL-server when the subscription job executes the method ProfileManager.GetAllProfiles(). From my investigations the error appears when users are registering to the site during this method is executed. On large sites this is a very common situation. Users do register all the time. &lt;/p&gt;  &lt;h2&gt;&lt;/h2&gt;  &lt;h2&gt;Solution&lt;/h2&gt;  &lt;p&gt;I have used Reflector to copy all code in EPiServer’s class SubscriptionJob to a new customized subscripttion job.&lt;/p&gt;  &lt;p&gt;I made some changes to the code. First of all there are some code that could be optimized. In my application the execution time for the subscription job has gone from 30 to 6 minutes, by implementing this fix.&lt;/p&gt;  &lt;p&gt;In the method protected virtual int SendSubscriptions(EPiServerProfile profile) there is no check if the user does subscribe to any pages or not. When you have large number of users and also a custom membership provider this will cause the job to run very slow. The PrincipalInfo of the users is fetched for all users. The method GetUser will be called for all users in the membership provider.    &lt;br /&gt;Some small changes to the code will fix this issue. Just check if the profile does subscribe to more than zero pages.&lt;/p&gt;  &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 151.15%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 166px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;   &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;     &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; SendSubscriptions(EPiServerProfile profile)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; num = 0;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (profile.SubscriptionInfo.SubscribedPages.Count &amp;gt; 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt;         IPrincipal principal = PrincipalInfo.CreatePrincipal(profile.UserName);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;         &lt;span style=&quot;color: #0000ff&quot;&gt;foreach&lt;/span&gt; (SubscriptionDescriptor descriptor &lt;span style=&quot;color: #0000ff&quot;&gt;in&lt;/span&gt; profile.SubscriptionInfo.SubscribedPages)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The solution to the real problem is more difficult. I have been able to get rid of many deadlocks but not all.&lt;/p&gt;

&lt;p&gt;The profiles are fetched in blocks of 1000 in the subscription job. Between every 1000 some work is done for sending subscription emails to the users. This takes some time. For the next 1000 users it can be a deadlock. I think this occurs if a new user have registered during this time.&lt;/p&gt;

&lt;p&gt;I tried to increase the pageSize for the methodProfileManager.GetAllProfiles() to decrease the time between the first and the last profile. The deadlocks are almost gone. Is there any reason why EPiServer do this job in page sizes of 1000? Is there a better solution to this problem?&lt;/p&gt;

&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 150.56%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;
  &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;
    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;virtual&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt; InternalExecute()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; num3;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt;     ProfileInfoCollection infos;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; num = 0;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; num2 = 0;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; pageSize = 200000;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt;     Label_0004:&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt;     infos = ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All, num2++, pageSize, &lt;span style=&quot;color: #0000ff&quot;&gt;out&lt;/span&gt; num3);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (infos.Count != 0)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;</id><updated>2010-02-08T14:03:24.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Users statistics gadget</title><link href="https://world.optimizely.com/blogs/Erik-Engstrand/Dates/2009/11/Users-statistics-gadget/" /><id>&lt;p&gt;After installing the EPiServer CMS 6 CTP I saw the Gadget contest on EPiSerer world. Here is my contribution to the contest. The users statistics gadget.&lt;/p&gt;
&lt;p&gt;It simply displays a chart with the number of users and subscription users you have registered on the site. It’s also possible to show a chart of the users in a specific role. All settings is done in the Edit menu.&lt;/p&gt;
&lt;p&gt;The chart is created in SIlverlight (&lt;a href=&quot;http://visifire.com/&quot; target=&quot;_blank&quot;&gt;Visifire&lt;/a&gt;). The Silverlight application accesses the users statistics from a WCF service. All wcf configurations is in the Gadget web.config. And therefore no need to update the web project’s web.config.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/link/6f5ebc4507734b12816667726027d552.png&quot;&gt;&lt;img style=&quot;BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/db131a8070114cd2b50e9271f4795975.png&quot; width=&quot;361&quot; height=&quot;362&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;h2&gt;Configuration&lt;/h2&gt;
&lt;p&gt;By clicking the Edit in the menu you will see some configuration options. You can choose to show statistics for one role of all roles in the RoleMembershipProvider.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;/link/06895f5775044e98afcc3f9f952c5f30.png&quot;&gt;&lt;img style=&quot;BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;/link/dda4fe13af8c477486ad9db6c0e174ec.png&quot; width=&quot;362&quot; height=&quot;371&quot; /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h2&gt;Save history data&lt;/h2&gt;
&lt;p&gt;The history data is stored in the DynamicDataStore. I have created a scheduled job which should be executed once a day. &lt;/p&gt;
&lt;p&gt;As seen in the image above I have made it possible to generate dummy data for the statistics. This is just for demo purposes.&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;
&lt;p&gt;If you have problems with the Silverlight chart. Add mime type to IIS: .xap&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; application/x-silverlight-app. &lt;a href=&quot;http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/&quot; target=&quot;_blank&quot;&gt;Configuring IIS for Silverlight Applications&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The clientaccesspolicy.xml must be placed in the root of your project to get the Silverlight wcf reference running. This is done by the installer below.&lt;/p&gt;
&lt;div style=&quot;PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px&quot; id=&quot;scid:12CF4F9E-00D5-4d59-A727-42B7641FBD93:96653902-0650-4dbe-9efd-61a5c6906761&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;
&lt;div&gt;Download &lt;a href=&quot;/link/6a4916ebc01b4c9a805f4bd10c11a088.zip&quot; target=&quot;_blank&quot;&gt;UsersStatistics&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2&gt;Source code&lt;/h2&gt;
&lt;div style=&quot;PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; DISPLAY: inline; FLOAT: none; PADDING-TOP: 0px&quot; id=&quot;scid:12CF4F9E-00D5-4d59-A727-42B7641FBD93:238bdecb-cc7d-441a-9fb1-2bb3cdfad4b4&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;
&lt;div&gt;Download &lt;a href=&quot;/link/db76a11cb8df45f9bc99870045464f44.zip&quot; target=&quot;_blank&quot;&gt;UsersStatistics&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;</id><updated>2009-11-07T23:59:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer Community and user attributes</title><link href="https://world.optimizely.com/blogs/Erik-Engstrand/Dates/2009/8/EPiServer-Community-and-user-attributes/" /><id>&lt;p&gt;This article will give some examples of how to work with attributes on users in the EPiServer Community. Attributes can also be used on other objects in the commnuity, such as blogs, but this will not be discussed here.&lt;/p&gt;  &lt;h3&gt;Adding attributes&lt;/h3&gt;  &lt;p&gt;To get it possible to work with an attribute, you must first add it. Click on the Attributes link in the Community tab. You will get this dialog:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/5b283aad53a64110ba2ff382f2036fcf.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;183&quot; alt=&quot;image&quot; src=&quot;/link/a09f492005384d8782771aaac5ff9b7d.png&quot; width=&quot;446&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I will here create an attribute “ServiceIdentifier” of type string for the IUser class. It will now be possible to set this attribute on all users.&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/4a42f43831894a5c81115c04e327a58c.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;274&quot; alt=&quot;image&quot; src=&quot;/link/688bcb6963684ba0947d7297ffb22761.png&quot; width=&quot;430&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;It is also possible to create custom attribute types. You can read about it here: &lt;a title=&quot;http://world.episerver.com/en/Articles/Items/Creating-a-Custom-EPiServer-Community-Module---Attribute-Data-Types/&quot; href=&quot;http://world.episerver.com/en/Articles/Items/Creating-a-Custom-EPiServer-Community-Module---Attribute-Data-Types/&quot;&gt;http://world.episerver.com/en/Articles/Items/Creating-a-Custom-EPiServer-Community-Module---Attribute-Data-Types/&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Set attribute value on the user&lt;/h3&gt;  &lt;p&gt;I will here set a guid to this newly created attribute. CurrentUser is a property of type IUser.&lt;/p&gt;  &lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 100.21%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 210px; background-color: #f4f4f4; text-align: left&quot;&gt;   &lt;div id=&quot;codeSnippet&quot; style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;     &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060&quot;&gt;   1:&lt;/span&gt; Guid guid = Guid.NewGuid();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (CurrentUser != &lt;span style=&quot;color: #0000ff&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; String.IsNullOrEmpty(CurrentUser.GetAttributeValue&amp;lt;&lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;ServiceIdentifier&amp;quot;&lt;/span&gt;)))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060&quot;&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060&quot;&gt;   4:&lt;/span&gt;     &lt;span style=&quot;color: #008000&quot;&gt;// Create a clone of the user to enable edit&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060&quot;&gt;   5:&lt;/span&gt;     IUser currentUserClone = CurrentUser.Clone() &lt;span style=&quot;color: #0000ff&quot;&gt;as&lt;/span&gt; IUser;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060&quot;&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060&quot;&gt;   7:&lt;/span&gt;     currentUserClone.SetAttributeValue&amp;lt;&lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;ServiceIdentifier&amp;quot;&lt;/span&gt;, guid.ToString());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060&quot;&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060&quot;&gt;   9:&lt;/span&gt;     &lt;span style=&quot;color: #008000&quot;&gt;// Save everything to the user&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum10&quot; style=&quot;color: #606060&quot;&gt;  10:&lt;/span&gt;     CommunitySystem.CurrentContext.DefaultSecurity.UpdateUser(currentUserClone);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum11&quot; style=&quot;color: #606060&quot;&gt;  11:&lt;font color=&quot;#000000&quot;&gt; &lt;/font&gt;&lt;/span&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;Get attribute value from the user&lt;/h3&gt;

&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 100.06%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 148px; background-color: #f4f4f4; text-align: left&quot;&gt;
  &lt;div id=&quot;codeSnippet&quot; style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;
    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt; (CurrentUser != &lt;span style=&quot;color: #0000ff&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; CurrentUser.GetAttributeValue&amp;lt;&lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;ServiceIdentifier&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060&quot;&gt;   4:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; String.Empty;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h3&gt;Search, find, query users given an attribute&lt;/h3&gt;

&lt;p&gt;You can create very advanced queries to search for users. The method IsServiceUser checks if there exists a user with the attribute “ServiceIdentifier” set to the value of guid. I don’t know know fast this kind of queries are on a huge number of users. Does anyone know?&lt;/p&gt;

&lt;div id=&quot;codeSnippetWrapper&quot; style=&quot;border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 99.63%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; height: 202px; background-color: #f4f4f4; text-align: left&quot;&gt;
  &lt;div id=&quot;codeSnippet&quot; style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;
    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum1&quot; style=&quot;color: #606060&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;bool&lt;/span&gt; IsServiceUser(&lt;span style=&quot;color: #0000ff&quot;&gt;string&lt;/span&gt; guid)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum2&quot; style=&quot;color: #606060&quot;&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum3&quot; style=&quot;color: #606060&quot;&gt;   3:&lt;/span&gt;     &lt;span style=&quot;color: #008000&quot;&gt;//Create a new BlogQuery&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum4&quot; style=&quot;color: #606060&quot;&gt;   4:&lt;/span&gt;     UserQuery uq = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; UserQuery();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum5&quot; style=&quot;color: #606060&quot;&gt;   5:&lt;/span&gt;     StringCriterion strCriterion = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; StringCriterion();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum6&quot; style=&quot;color: #606060&quot;&gt;   6:&lt;/span&gt;     strCriterion.Value = guid;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum7&quot; style=&quot;color: #606060&quot;&gt;   7:&lt;/span&gt;     uq[&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;ServiceIdentifier&amp;quot;&lt;/span&gt;] = strCriterion;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum8&quot; style=&quot;color: #606060&quot;&gt;   8:&lt;/span&gt;     &lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; CommunitySystem.CurrentContext.DefaultSecurity.GetQueryResult(uq).Count &amp;gt; 0;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style=&quot;padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none&quot;&gt;&lt;span id=&quot;lnum9&quot; style=&quot;color: #606060&quot;&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;</id><updated>2009-08-20T09:28:56.6370000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>ImageVault and EPiServer page provider does not work together</title><link href="https://world.optimizely.com/blogs/Erik-Engstrand/Dates/2009/5/ImageVault-and-EPiServer-page-provider-does-not-work-together/" /><id>&lt;p&gt;I have an an EPiServer CMS 5 R2 installation with ImageVault 3.3.0.541 installed. Yesterday I tried to add a custom page provider to the project. I used the XML page provider found here: &lt;a href=&quot;http://world.episerver.com/en/Articles/Items/Introducing-Page-Providers/#download &quot; target=&quot;_blank&quot;&gt;http://world.episerver.com/en/Articles/Items/Introducing-Page-Providers/#download &lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You will get the error: &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;/link/05f7774aa1d3485bb57b52f3d88d1889.png&quot;&gt;&lt;img title=&quot;image&quot; style=&quot;border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;332&quot; alt=&quot;image&quot; src=&quot;/link/f93f9f287d9548fc899bcd9557832065.png&quot; width=&quot;365&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;EPiServer.BaseLibrary.ClassFactoryException: ClassFactory not initialized&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;and&lt;/p&gt;  &lt;p&gt;&lt;em&gt;[TypeInitializationException: The type initializer for &#39;EPiServer.DataFactory&#39; threw an exception.]&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;EPiServer made some changes to the startup events of the application in R1 SP3. ImageVault does not implement the startup in this new way. If you look deeper in the stack trace you will see:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;[Exception: Error initializing CreatedPageEvent in PluginStartup] ImageStoreNET.PluginStartup.get_CreatedPageEvent() +126&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;ImageVault hookes up the &lt;strong&gt;CreatedPageEvent&lt;/strong&gt; to early and therefore the DataFactory.Instance isn’t instantiated. &lt;/p&gt;  &lt;h3&gt;Get the web site running&lt;/h3&gt;  &lt;p&gt;The problem is with the handler &amp;lt;add name=&amp;quot;ImageVault&amp;quot; type=&amp;quot;ImageStoreNET.PluginStartup, ImageVault.EPiServer5&amp;quot; /&amp;gt;. Just comment this line and the application will start. I don&#39;t&#39; know what this handler does but probably ImageVault will come up with a solution soon.&lt;/p&gt;</id><updated>2009-05-12T09:04:36.1300000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Silverlight + EPiServer</title><link href="http://erikengstrand.blogspot.com/2009/03/silverlight-episerver.html" /><id>F&#246;r ett tag sedan lanserade vi en site gjord i Silverlight och EPiServer CMS 5 R2. Det fungerar mycket bra och vi har gjort en hel del smarta funktioner f&#246;r att h&#228;mta och spara data i EPiServer.&lt;br /&gt;&lt;br /&gt;L&#246;sningen som &#228;r lite av ett Community anv&#228;nder mycket personalisering i .NET. Silverlight har fullt st&#246;d f&#246;r .Net profiles, authorization och authentication via WCF (Windows Communication Foundation). Detta &#228;r helt grymt bra och l&#228;tt att jobba med.&lt;br /&gt;&lt;br /&gt;Kanske kommer det lite mer information om siten i fr&#229;ga vid ett senare tillf&#228;lle.</id><updated>2009-03-10T13:45:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer Scheduled jobs not working - solution</title><link href="http://erikengstrand.blogspot.com/2009/02/episerver-scheduled-jobs-not-working.html" /><id>Hi&lt;br /&gt;&lt;br /&gt;You may get an error like this: Object reference not set to an instance of an object in your scheduled job. This only occurs when executing the job as scheduled, not manually.&lt;br /&gt;&lt;br /&gt;I had big problems with this and found the solution.&lt;br /&gt;The HttpContext.Current is null when running the job scheduled.&lt;br /&gt;&lt;br /&gt;I&#39;m using HttpContext.Current.Cache a lot when caching data in .Net. E.g. when reading from a file I usully place it in the cache with a CacheDependency attached to it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt; (Does not work in EPiServer scheduled jobs)&lt;br /&gt;public static XDocument AreaExtraItemXDocument&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;XDocument areaExtraItemXpath = (XDocument)HttpContext.Current.Cache[&quot;CacheKey&quot;];&lt;br /&gt;if (areaExtraItemXpath == null)&lt;br /&gt;{&lt;br /&gt;string xmlPath = &quot;c:\file.xml&quot;;&lt;br /&gt;if (File.Exists(xmlPath))&lt;br /&gt;{&lt;br /&gt;CacheDependency cacheDep = new CacheDependency(xmlPath);&lt;br /&gt;areaExtraItemXpath = XDocument.Load(xmlPath);&lt;br /&gt;HttpContext.Current.Cache.Insert(&quot;CacheKey&quot;, areaExtraItemXpath, cacheDep);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;return areaExtraItemXpath;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public static XDocument AreaExtraItemXDocument&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;XDocument areaExtraItemXpath = null;&lt;br /&gt;if (HttpContext.Current == null  HttpContext.Current.Cache[&quot;CacheKey&quot;] == null)&lt;br /&gt;{&lt;br /&gt;string xmlPath = &quot;c:\file.xml&quot;;&lt;br /&gt;if (File.Exists(xmlPath))&lt;br /&gt;{&lt;br /&gt;areaExtraItemXpath = XDocument.Load(xmlPath);&lt;br /&gt;if (HttpContext.Current != null)&lt;br /&gt;{&lt;br /&gt;CacheDependency cacheDep = new CacheDependency(xmlPath);&lt;br /&gt;HttpContext.Current.Cache.Insert(&quot;CacheKey&quot;, areaExtraItemXpath, cacheDep);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;areaExtraItemXpath = (XDocument)HttpContext.Current.Cache[&quot;CacheKey&quot;];&lt;br /&gt;}&lt;br /&gt;return areaExtraItemXpath;&lt;br /&gt;}&lt;br /&gt;}</id><updated>2009-02-10T13:27:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>SSL redirect komponent</title><link href="http://erikengstrand.blogspot.com/2009/01/ssl-redirect-komponent.html" /><id>Jag har p&#229; en site haft behovet att redirecta mellan http och https och vice versa. Detta g&#228;ller p&#229; vissa sidor som inneh&#229;ller k&#228;nslig information f&#246;r den inloggade anv&#228;ndaren, tex personnummer. Kravet har d&#229; varit att det alltid m&#229;ste vara https p&#229; k&#228;nsliga sidor och http p&#229; &#246;vriga sidor. En l&#246;sning kan ju vara att k&#246;ra https p&#229; alla sidor p&#229; siten, men det &#246;kar trafiken v&#228;sentligt om bara en liten del av siten egentligen beh&#246;ver https.&lt;br /&gt;&lt;br /&gt;Det finns vissa l&#246;sningar med javascript och en redirect.htm. Dock s&#229; har denna metod inte fungerat med EPiServers friendly url rewriter.&lt;br /&gt;L&#246;sningen var detta projekt som sk&#246;ter allt det jag vill: &lt;a href=&quot;http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx&quot;&gt;http://www.codeproject.com/KB/web-security/WebPageSecurity_v2.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Man kan &#228;ven g&#246;ra alla inst&#228;llningar om vilka sidor som ska vara s&#228;kra och inte i web.config, vilket &#228;r v&#228;ldigt smidigt.&lt;br /&gt;&lt;br /&gt;Har man ISA-server s&#229; m&#229;ste en del inst&#228;llningar g&#246;ras, enligt denna: &lt;a href=&quot;http://goatly.spaces.live.com/blog/cns!ED869F22AB5C24A8!267.entry&quot;&gt;http://goatly.spaces.live.com/blog/cns!ED869F22AB5C24A8!267.entry&lt;/a&gt;</id><updated>2009-01-29T15:15:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer CMS Certified Developer</title><link href="http://erikengstrand.blogspot.com/2009/01/episerver-cms-certified-developer.html" /><id>Yesterday, I passed the certification for EPiServer CMS 5. The test was quiet easy and my final result was 85%.</id><updated>2009-01-28T10:48:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer CMS 5 R2 and 4 on the same server</title><link href="http://erikengstrand.blogspot.com/2009/01/episerver-cms-5-r2-and-4-does-not-work.html" /><id>I thought EPiServer CMS R2 wouldn&#39;t work on the same server as EPiServer 4. The problem was the scheduler that did not work on the EPiServer 4 site. After some testing this was not the case. Se old blog post below.&lt;br /&gt;&lt;br /&gt;The solution is to follow this: &lt;a href=&quot;/link/2acac8fbf8cb4884a84bc2d48b22104e.aspx&quot;&gt;http://world.episerver.com/en/FAQ/Items/Running-the-scheduler-on-machines-with-both-EPiServer-CMS-4-and-5-installations/&lt;/a&gt;&lt;br /&gt;Use version 5.1.422.4, not 5.1.422.172. It seems odd, but EPiServers scheduler in R2 uses the 5.1.422.4 version.&lt;br /&gt;&lt;br /&gt;Also check this if you have problems that the jobs i not executed: &lt;a href=&quot;/link/669556c5febd41a090869b4d26cbb1e4.aspx&quot;&gt;http://world.episerver.com/FAQ/Items/Scheduler-does-not-run-scheduled-jobs-automatically/&lt;/a&gt;&lt;br /&gt;You can found the xml file here: C:\Program Files\EPiServer\Shared\Services\Scheduler Service&lt;br /&gt;&lt;br /&gt;Old post:&lt;br /&gt;&lt;em&gt;Today I encoutered a huge problem with EPiServer.&lt;br /&gt;You can&#39;t have EPiServer CMS 5 R2 and EPiServer 4 on the same production server. The reason is the EPiServer scheduler. R2 has a new scheduler which is not compatible with EPiServer 4.&lt;br /&gt;When you install the installation package for R2, it will uninstall the old scheduler. Very bad.&lt;br /&gt;&lt;br /&gt;To get the EPiServer 4 scheduler back to work you have to do the following:&lt;br /&gt;- Uninstall &quot;EPiServer Shared&quot;&lt;br /&gt;- Install an EPiServer 4 site from EPiServer Manager. This will install the scheduler service again.&lt;br /&gt;&lt;br /&gt;If you are running EPiServer CMS 5 R1 and EPiServer 4 on the same server. These two versions does work together with some tweaks. Follow these two FAQ:s after installing an EPiServer CMS 5 R1 site from EPiServer Manager:&lt;br /&gt;&lt;br /&gt;http://world.episerver.com/en/FAQ/Items/Running-the-scheduler-on-machines-with-both-EPiServer-CMS-4-and-5-installations/&lt;br /&gt;(5.1.422.4 can be 5.1.422.172 depending on which SP of EPiServer you have installed)&lt;br /&gt;&lt;br /&gt;http://world.episerver.com/FAQ/Items/Scheduler-does-not-run-scheduled-jobs-automatically/&lt;br /&gt;&lt;br /&gt;If anyone knows a solution to have EPiServer 4 and EPiServer 5 R2 on the same server, please let me know.&lt;/em&gt;</id><updated>2009-01-23T12:40:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>This installation contains only core files</title><link href="http://erikengstrand.blogspot.com/2008/11/this-installation-contains-only-core.html" /><id>When installing a new EPiServer CMS 5 website without a database you will get this message when browsing the site:&lt;br /&gt;&quot;This installation contains only core files&quot;&lt;br /&gt;&lt;br /&gt;Just delete the file default.htm from your webroot.</id><updated>2008-11-07T08:35:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>Dynamically add custom page provider</title><link href="http://erikengstrand.blogspot.com/2008/11/dynamically-add-custom-page-provider.html" /><id>The page provider functionality is a great feature in EPiServer CMS 5 R2. The providers can easily be added through Web.config as described here:&lt;br /&gt;http://world.episerver.com/en/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2/Page-Providers/&lt;br /&gt;&lt;br /&gt;If you want to add the page provider programmatically, this is one solution:&lt;br /&gt;&lt;br /&gt;        protected void Application_BeginRequest(Object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            //Only add page provider if it does not exist&lt;br /&gt;            if (DataFactory.Instance.ProviderMap.GetPageProvider(&quot;xml&quot;) == null)&lt;br /&gt;            {&lt;br /&gt;                //Create page provider&lt;br /&gt;                XmlPageProvider pageProvider = new XmlPageProvider();&lt;br /&gt;&lt;br /&gt;                //Add page provider settings&lt;br /&gt;                NameValueCollection valueCol = new NameValueCollection();&lt;br /&gt;                valueCol.Add(&quot;filePath&quot;, &quot;~/XmlPageProvider/externalPages.xml&quot;);&lt;br /&gt;                valueCol.Add(&quot;entryPoint&quot;, &quot;16&quot;);&lt;br /&gt;                valueCol.Add(&quot;capabilities&quot;, &quot;Create,Edit,Delete,Search&quot;);&lt;br /&gt;                pageProvider.Initialize(&quot;xml&quot;, valueCol);&lt;br /&gt;&lt;br /&gt;                //Add page provider to the provider map&lt;br /&gt;                DataFactory.Instance.ProviderMap.AddPageProvider(pageProvider);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;I&#39;m here adding the same xml page provider which is described in the link above.</id><updated>2008-11-06T13:02:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer 5 upgrade to R2</title><link href="http://erikengstrand.blogspot.com/2008/10/episerver-5-upgrade-to-r2.html" /><id>&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Upgrade crashes&lt;/span&gt;&lt;br /&gt;In your development EPiServer project some files may be source controlled. The files may then be read only and therefore the upgrade crashes.&lt;br /&gt;Set the following directories to writeable:&lt;br /&gt;- App_Browsers&lt;br /&gt;- App_Themes/Default&lt;br /&gt;- Util&lt;br /&gt;- WebServices&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Clean up your project after upgrading&lt;/span&gt;&lt;br /&gt;Delete the assembly bindings and to these assamblies:&lt;br /&gt;- EPiServer.WebParts.dll&lt;br /&gt;- EPiServer.WorkflowFoundation.UI.dll&lt;br /&gt;- EPiServer.ContentChannelService.dll&lt;br /&gt;- EPiServer.SchedulerSvc.dll&lt;br /&gt;- EPiServer.LogService.dll&lt;br /&gt;- EPiServer.IndexingService.dll&lt;br /&gt;- ElektroPost.Win32.dll&lt;br /&gt;&lt;br /&gt;Also delete references from your project to the above assemblies.&lt;br /&gt;&lt;br /&gt;Delete these files in the bin\ directory:&lt;br /&gt;- EPiServer.LogService.exe.config&lt;br /&gt;- EPiServer.SchedulerSvc.exe.config&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;Missing references&lt;/span&gt;&lt;br /&gt;In your development project sometimes some EPiServer references are missing after the upgrade. The best is to delete these references from the project. Then add them back by browsing to c:\&lt;program&gt;\EPiServer\CMS\5.2.375.7\bin&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;IIS 6 Page not found on .htm files&lt;/span&gt;&lt;br /&gt;When you upgrade an EPiServer site to R2 some code is not added to the web.config.&lt;br /&gt;The location UI should be like this:&lt;br /&gt;&lt;location path=&quot;UI&quot;&gt;&lt;/location&gt;&lt;/program&gt;</id><updated>2008-10-31T09:59:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>XForms EPiServer does not submit</title><link href="http://erikengstrand.blogspot.com/2008/09/xforms-episerver-does-not-submit.html" /><id>I got some problems with XForms in EPiServer 4.62 today. Earlier the forms have worked great and no problem at all. But suddenly all newly created forms did not work. They were impossible to submit.&lt;br /&gt;&lt;br /&gt;The problem turned out to be that I saved the XForms in the XForm editor i Internet explorer 8 beta 2. There might some other browsers that have the same problem.&lt;br /&gt;&lt;br /&gt;The solution is to open the form and save it in Internet explorer 7.&lt;br /&gt;&lt;br /&gt;When saving in IE8 i get this code for the submit button:&lt;br /&gt;&lt;strong&gt;input onclick=&quot;return(false)&quot; value=&quot;Submit&quot; type=&quot;submit&quot; action=&quot;http://localhost/sql&quot;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This should be:&lt;br /&gt;&lt;strong&gt;input type=&quot;submit&quot; value=&quot;Submit&quot; onclick=&quot;if (typeof(Page_ClientValidate) == &#39;function&#39;) Page_ClientValidate();&quot;&lt;/strong&gt;</id><updated>2008-09-09T10:27:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer Migration tool problems</title><link href="http://erikengstrand.blogspot.com/2008/06/episerver-migration-tool-problems.html" /><id>When migrating an EPiServer site to EPiServer CMS 5 some problems may occur.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When following the procedure at &lt;a href=&quot;http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-SP2/Migration-Tool-RC1/&quot;&gt;http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-SP2/Migration-Tool-RC1/&lt;/a&gt; you may get some problem before you start the Migration Tool.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Upgrading to EPiServer 4.62&lt;/strong&gt;&lt;br /&gt;One step is to upgrade the site to EPiServer 4.62.&lt;br /&gt;If you are connecting to the SQL via Integrated Security SSPI you will get this error:&lt;br /&gt;&lt;strong&gt;Failed to connect to SQL database: Login failed for user &#39;&#39;. The user is not associated with a trusted SQL Server connection&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;I think the problem is that EPiServer Manager does not deal with integrated security.&lt;br /&gt;The solution for me was to create an SQL user and change the Web.config to connect to the SQL database with this user. After the installation is finished you should change back to Intagrated security again.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;EPiServer Migration Tool&lt;/strong&gt;&lt;br /&gt;When running the migration tool you may get this error:&lt;br /&gt;&lt;strong&gt;System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The partner transaction manager has disabled its support for remote/network transactions&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The problem occurs when running transactions (e.g. TransactionScope) via DTC. You can read about how to fix this problem here:&lt;br /&gt;&lt;a href=&quot;http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/7172223f-acbe-4472-8cdf-feec80fd2e64/&quot;&gt;http://social.msdn.microsoft.com/forums/en-US/adodotnetdataproviders/thread/7172223f-acbe-4472-8cdf-feec80fd2e64/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You may get this error after the above problem is solved:&lt;br /&gt;&lt;p&gt;&lt;strong&gt;System.Transactions.TransactionManagerCommunicationException: Communication with the underlying transaction manager has failed.&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The transactions will timeout if the transactions are too large. You should add the following to the bottom of the machine.config to increase the timeout (iisreset is required):&lt;/p&gt;&lt;p&gt;&amp;lt;system.transactions&amp;gt;&lt;br /&gt;&amp;lt;machineSettings maxTimeout=&quot;02:00:00&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/system.transactions&amp;gt;&lt;/p&gt;You should also open port 134 in the firewall between the webservers and the SQL server.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;FONT-WEIGHT: bold&quot;&gt;This seem to work in development environment. But when applied in production you can get other problems with e.g. Upload directory. The best is to get the MSDTC tp work properly&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;FONT-STYLE: italic&quot;&gt;You can also try to add Enlist=false; to the end of the connection string. Remember to set the connection string back to what is was before the migration when the migration is finished. Enlist=false disables the MSDTC in some way.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;System.Data.SqlClient.SqlException: Cannot find the object &#39;RetrieveCompletedScope&#39;, because it does not exist or you do not have permission.&lt;/strong&gt;&lt;br /&gt;This occurs due to a bug in Microsofts SQL-scripts for Windows Worklflow Foundation. A store procedure in this script is not created as dbo. Therefore it will get the schema of the user you are using.&lt;br /&gt;The file to change is placed here: C:\WINDOWS\microsoft.NET\Framework\v3.0\Windows Workflow Foundation\SQL\EN&lt;br /&gt;&lt;br /&gt;Add a [dbo]. before RetrieveCompletedScope at the line 370 &quot;CREATE PROCEDURE RetrieveCompletedScope&quot;.&lt;br /&gt;It should be &quot;CREATE PROCEDURE [dbo].RetrieveCompletedScope&quot;</id><updated>2008-06-04T13:20:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer custom property with AJAX</title><link href="http://erikengstrand.blogspot.com/2008/03/episerver-custom-property-with-ajax.html" /><id>I EPiServer CMS 5 &#228;r det r&#228;tt enkelt att g&#246;ra custom properties. Om man vill ha AJAX-funktionalitet i dessa s&#229; har jag ett s&#228;tt man kan g&#246;ra detta p&#229;.&lt;br /&gt;&lt;br /&gt;public override void CreateEditControls()        {&lt;br /&gt;//Add scriptmanager           &lt;br /&gt;if (ScriptManager.GetCurrent(this.Page) == null)            {&lt;br /&gt;                this.Controls.Add(new ScriptManager());           &lt;br /&gt;}&lt;br /&gt;            updatePanel = new UpdatePanel();&lt;br /&gt;            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;&lt;br /&gt;            updatePanel.ChildrenAsTriggers = true;&lt;br /&gt;&lt;br /&gt;//Add content to UpdatePanel&lt;br /&gt;updatePanel.ContentTemplateContainer.Controls.Add(/* control to add */);&lt;br /&gt;this.Controls.Add(updatePanel);&lt;br /&gt;&lt;br /&gt;I detta exempel kommer allt som l&#228;ggs till i updatePanel.ContentTemplateContainer att g&#246;ra asynkron postback.</id><updated>2008-03-19T10:46:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>EPiServer CMS 5 + .Net 3.5 + Ajax = sant</title><link href="http://erikengstrand.blogspot.com/2008/02/episerver-cms-5-net-35-ajax-sant.html" /><id>I EPiServer 4.x beh&#246;vdes det en hel del handp&#229;l&#228;ggning f&#246;r att p&#229; Microsofts AJAX att fungera. I senaste EPiServer-versionen &#228;r det riktigt enkelt att f&#229; ig&#229;ng, speciellt om man k&#246;r .Net 3.5 d&#228;r Microsofts AJAX-ramverk &#228;r inbyggt.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Det enda man beh&#246;ver g&#246;ra &#228;r att starta upp EPiServer-projektet i Visual Studio 2008 och sedan v&#228;lja att k&#246;ra med framwork .Net 3.5. Efter detta &#228;r det bara att tuta och k&#246;ra med UpdatePanels eller andra kontroller i &lt;a href=&quot;http://ajax.asp.net/ajaxtoolkit/&quot;&gt;AjaxToolkit&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;N&#228;r man startar upp ett EPiServer projekt i VS 2008 s&#229; vill den konvertera projektet, detta m&#229;ste man s&#229;klart g&#246;ra.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sedan kommer nog en dialog ruta som s&#228;ger att virtuella katalogen PublicTemplates inte finns i IIS. Vill man ha sitt EPiServer-projekt som en virutell katalog s&#229; ska man s&#229;klart skapa denna virtuella katalog och sedan k&#246;ra p&#229; det.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id=&quot;BLOGGER_PHOTO_ID_5163767070412908066&quot; style=&quot;DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 551px; CURSOR: hand; TEXT-ALIGN: center&quot; alt=&quot;&quot; src=&quot;http://4.bp.blogspot.com/_1BuiPkqaQr4/R6liyq7SJiI/AAAAAAAAAAU/pheVN6vcR9A/s400/publictemplates_dialog.png&quot; width=&quot;452&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;Jag brukar klicka Ja h&#228;r och sedan g&#246;ra f&#246;ljande: &lt;ol&gt;&lt;li&gt;G&#229; in p&#229; Properties p&#229; projektfilen i Visual Studio.&lt;/li&gt;&lt;li&gt;Under fliken Web, &#228;ndra Use IIS Web Server till &lt;a href=&quot;http://localhost/&quot;&gt;http://localhost/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Ta bort den virtuella katalog med namn PublicTemplats som skapades i IIS.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Detta l&#246;ser &#228;ven det felmeddelande som annars ligger i varje fil:&lt;/p&gt;&lt;p&gt;ASP.NET runtime error: The configSource file &#39;connectionStrings.config&#39; is also used in a parent, this is not allowed.&lt;/p&gt;&lt;p&gt;K&#246;r h&#229;rt med EPiServer, Ajax och .Net 3.5&lt;/p&gt;</id><updated>2008-02-15T08:21:00.0000000Z</updated><summary type="html">Blog post</summary></entry> <entry><title>VirtualPathProvider EPiServer</title><link href="http://erikengstrand.blogspot.com/2008/02/virtualpathprovider-episerver.html" /><id>Har senaste tiden grejat lite med VirtualPathProvider i EPiServer CMS 5. Kom p&#229; n&#229;gra till synes enkla ting man kan g&#246;ra.&lt;br /&gt;&lt;br /&gt;F&#246;r att l&#228;sa in en bild som Stream kan man g&#246;ra det p&#229; f&#246;ljande s&#228;tt:&lt;br /&gt;Stream fileStream = VirtualPathProvider.OpenFile(imagePath);&lt;br /&gt;&lt;br /&gt;Sedan om man vill tex l&#228;sa ut n&#228;r en fil senast &#228;r &#228;ndrad kan man g&#246;ra s&#229; h&#228;r:&lt;br /&gt;UnifiedFile file = (UnifiedFile)HostingEnvironment.VirtualPathProvider.GetFile(imagePath);&lt;br /&gt;DateTime lastUpdated = file.Changed;&lt;br /&gt;&lt;br /&gt;Kolla om en fil finns VPP:&lt;br /&gt;if (HostingEnvironment.VirtualPathProvider.FileExists(imagePath))&lt;br /&gt;&lt;br /&gt;Detta kan tex kanske vara intressant om man vill skala ner bilder eller p&#229; n&#229;got s&#228;tt &#228;ndra dem innan de renderas ut till klienten.</id><updated>2008-02-06T14:17:00.0000000Z</updated><summary type="html">Blog post</summary></entry></feed>