How to show Allowed types on Content Area – Grzegorz Wiecheć

Nice solution for EPiServer editors to be able to see which kind of content types that can be added to a content area in EPiServer. This solution is for older Episerver versions e.g. around 2015.

In EPiServer 11+ the js is minifed and inside a zip file at this location:
[EPiServer root folder]\modules\_protected\CMS\CMS.zip\11.4.6\ClientResources\epi-cms\contentediting\editors
I wont touch that for now but if someone does, please let us all know.

Content References list with allowed types

Read more here: How to show Allowed types on Content Area – Grzegorz Wiecheć

EPiServer Admin Import data – Fixing the Request timed out exception

If you are importing a big file of data into EPiServer through the admin import data feature, you might get this exception:

Exception Details: System.Web.HttpException: Request timed out.

ASP.NET has a timeout of 120 seconds by default, you can increase this setting for the admin section only using the following setting.

Add this directly under the location path admin / system.web element:

<httpRuntime executionTimeout="999999" maxRequestLength="2097151" />

E.g. in web.config:

...
<location path="epi/CMS/admin">
    <system.web>
      <httpRuntime executionTimeout="999999" maxRequestLength="2097151" /> 
      <authorization>
        <allow roles="WebAdmins, Administrators" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>
...

Source: https://support.microsoft.com/en-ca/help/925083/error-request-timed-out-when-you-try-to-upload-a-large-file-to-a-docum

EPiServer edit and admin not working after upgrade to EPiServer 11.8

I have upgraded a site from EPiServer 7.5 to 11.8.
When deploying the upgraded site to the test environment the edit and admin interface stopped working (the top episerver ui menu visible but lots of js errors and no “main edit window visible” and entire admin mode 404 not found).

The problem was related to some old config for “ProtectedAddons”, i just commented the below config in web.config on test server and the edit and admin mode works again.

(comment out/remove below from web.config)

<!--<virtualPathProviders>
<clear />
<add name="ProtectedAddons" virtualPath="~/epi/" physicalPath="[appDataPath]\Modules" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet" />
</virtualPathProviders>-->

Inspiration for the solution came from here: Object reference error in initialization modules

Extension methods for obtaining ContentReference from LinkItem and Url

(for EPiServer 8+)

…two simplified methods to cover LinkItem and Url:

public static ContentReference ToContentReference(this LinkItem linkItem)
        {
            if (linkItem == null)
                return ContentReference.EmptyReference;

            var content = UrlResolver.Current.Route(new UrlBuilder(linkItem.Href));
            return content != null ? content.ContentLink : ContentReference.EmptyReference;
        }

And

public static ContentReference ToContentReference(this Url url)
        {
            if (url == null)
                return ContentReference.EmptyReference;

            var content = UrlResolver.Current.Route(new UrlBuilder(url));
            return content != null ? content.ContentLink : ContentReference.EmptyReference;
        }

Source: Safest method of obtaining ContentReference from LinkItem

EPiServer CMS 11 reset search index url (EPiServe built in search)

(By THACH Lockevn, 1/4/2018 9:46:19 AM) To reset the search index, admin goes to IndexContent.aspx In CMS 11, IndexContent.aspx is included in the new EPiServer.Search.Cms package The URL has changed from /EPiServer/CMS/Admin/IndexContent.aspx  to /EPiServer/EPiServer.Search.Cms/IndexContent.aspx

Source: Breaking changes (CMS 11)

PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade

Upgrading EPiServer 8 to 9 might result in this warning:

Warning CS0618 ‘PermanentLinkMapStore.TryToMapped(string, out string)’ is obsolete: ‘This method only supports classic/mapped url’s which are no longer used since 8.0 – use PermanentLinkUtility.GetGuid(url) to get the unique ID from an URL’

How to solve warning:

You can try:

EPiServer.Web.Routing.UrlResolver.Current.GetPermanent();

or

EPiServer.Web.Routing.UrlResolver.Current.TryToPermanent();

to get a permanent link

 

See more info here: PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade

Import existing EPiServer users into an empty database – EPiServer 7.5

Here is a short guide for importing users from an existing EPiServer site into an empty EPiServer site. And then setup the default user groups and access rights. This is for EPiServer 7.5 using the standard Sql Membership but will probably work fine with newer EPiServer versions as well.

Create empty db

Run deployment center as administrator -> select create Sql db.

Importing users from old/other db:

How to copy table data, see this guide: https://www.sqlshack.com/how-to-copy-tables-from-one-database-to-another-in-sql-server/
The tables are named like: aspnet_Applications

Marked in bold are the tables that was used by my EPiServer 7.5 installation (the other tables where just empty). This is the order used, (see the link above), making sure the Users table is uploaded early on is important.

1. Application
2. Users
3.Membership
4.Paths
5.PersonalizationAllUsers
6.PersonalizationPerUser
7.Profile
8.Roles
9.Events
10.UsersInRoles (watch out for FK constraints to Users and Roles)
11.SchemaVersions (identical between same EPiServer db versions)

Create users and roles from scratch

Override the access protection to EPiServer admin until valid admin user and user groups are created:

Find location elements in web.config and comment out:

<location path="epi">

Comment out the <authorization> element entirely (removes the access protection). The same for location:

<location path="epi/CMS/admin">

Goto http://mysite.local/epi/CMS/Admin/Default.aspx or similar for epi admin area.

Create new roles in admin: (these are EPiServer defaults)
WebEditors
WebAdmins

Add your admin user  to WebEditors and WebAdmins group.

Goto admin “Set access rights”

Set correct access rights for editors and admin groups.
Check lower checkbox to make descendant content inherit the rights.
Also “Everyone” group should have Read access on root and downwards.

Set this in web.config:

<siteSettings pageRootId="1" pageStartId="1"

PagestartId should be root id.

Uncomment the authorization for /epi and /epi/cms/admin (enable the authorization again).

Login with you admin user
Create a start page or import an episerver export xml file.
Run  [mysite.local]/epi/CMS/Admin/IndexContent.aspx to update search index if imported content.

Goto site settings in admin and point out the page as start page. And/or set in web.config

<siteSettings pageRootId="1" pageStartId="4"

(usually becomes 4)

Goto site settings in admin and point out the all site hosts (dev, test, prod etc).
Add more users such as editors and adminstrators that need access to site.

EPiServer – Comparing list properties

Probably in every EPiServer project there will be a need to store a list of links to your content pages. EPiServer.CMS.UI 8.6.0 introduced a new multiple ContentReference property. Usually we could use a single property to store a collection of links. For example when building a media slideshow or when displaying links in a site footer. Using EPiServer there are several possibilities of implementation.

List properties: ContentArea, LinkItemCollection, multiple ContentReference

Read more here: Comparing list properties – Grzegorz Wiecheć