Sharing Widget for EPiServer 7

Sharing Widget add-on provides easy way to get ShareThis buttons on EPiServer 7 site. Just create new block, specify your publisher ID and drop it on a page. Both Web Forms and MVC are supported.


Please download Sharing Widget add-on package to install using Manual Upload option.

Source code is available on GitHub.

This module was developed as a sample add-on for EPiServer 7 Preview. Now it is rebuilt for RTM version. Please see details about most important fixes below if you are interested.


Your feedback is highly appreciated. Please let me know if you are interested in further add-on development and which features you would like to see (selecting required buttons, size, other settings?). Don’t hesitate to report bugs and issues or leave a comment here.

Known issue with add-on block rendering on MVC site

There is a known issue with shared block rendering when the block is deployed as an add-on/module on EPiServer 7 MVC site. You will get similar error when viewing a block or page that contains add-on block in content area:

Server Error in '/TestMvc' Application. 
The controller for path '/TestMvc/UIPath/CMS/en/,,183_207/' was not found or does not implement IController.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: The controller for path '/TestMvc/UIPath/CMS/en/,,183_207/' was not found or does not implement IController.

Source Error: 

Line 23:         public virtual void RenderAction(HtmlHelper helper, string action, string controller, object routeValues)
Line 24:         {
Line 25:             helper.RenderAction(action, controller, routeValues);
Line 26:         }
Line 27:     }

As far as I can see the problem is that MVC has a cache of known controllers and this cache is created based on the list of assemblies defined in system.web/compilation/assemblies section in web.config. It also includes the main application assembly that is associated with global.asax code.

MVC uses that cache to find block controller by name convention (FooBlock -> FooBlockController) and it fails because controllers from module/add-on assemblies are not listed in that cache since add-on system does not change the configuration files.

Updated: the fix is available in EPiServer 7 Patch 1 update (bug #91052).


Go get and install EPiServer 7 Patch 1. That's it.

Simple workaround

Consider installing EPiServer 7 Patch 1! No? Then the simple workaround is to add add-on assembly in system.web/compilation/assemblies section in web.config manually:

<?xml version="1.0" encoding="utf-8"?>
    <compilation … >
        <add assembly="EPiServer.Samples.SharingWidget" />

Tricky workaround

Another workaround for real geeks is to implement initialization class which registers required add-on/module assembly programmatically. For example, it could register all assemblies in modulesbin folder to fix this issue for all add-ons.

Assembly that contains initialization class should be marked with PreApplicationStartMethodAttribute and should reside in site bin folder. Please see more information about this attribute here.

Rebuilding the add-on for EPiServer 7

To keep it simple I decided to not introduce any new functionality and tried to concentrate on what should be changed to make it work with EPiServer 7.

Surprisingly, there was not so much to update. You can see most of changes in this commit.

Block controller

This is probably the only one required change: the name of block data parameter in Index method is changed from blockData to currentBlock, otherwise current block data is not passed in action method and you get NullReferenceException when rendering content in the view.

public class SharingWidgetBlockController : BlockController<SharingWidgetBlock>
    public override ActionResult Index(SharingWidgetBlock currentBlock)
        // Hint for MVC to find the view in modules folder:
        return PartialView(Paths.ToResource(GetType(), "Views/SharingWidget/SharingWidget.cshtml"), currentBlock);

That was not so obvious, huh?

Translation for content type and property names and descriptions

Embedded language file for English is added. Titles and descriptions for Sharing Widget block type and properties are defined in /language/blocktypes/blocktype and /language/pagetypes/common/property nodes.

<?xml version="1.0" encoding="utf-8" ?>
  <language name="English" id="en">
      <!-- Blocks -->
      <blocktype name="SharingWidgetBlock">
        <name>Sharing Widget</name>
        <description>Adds ShareThis widget on pages where block is placed.</description>
        <!-- Sharing block properties -->
        <property name="PublisherId">
          <caption>Publisher ID</caption>
          <help>Register on to get your Publisher ID. You can also use "Get sharing tools" wizard on to generate button code and get publisher ID without registration.</help>

It’s a bit strange to describe block properties in pagetypes structure; hopefully it will be fixed in one of the next platform updates.

Module manifest for add-on

Add-on assembly is explicitly specified in module.config file to avoid automatic discovering of available assemblies in add-on bin folder.

Restricting prerequisites version

Dependency on EPiServer assembly is specified in add-on nuspec file. For this version the prerequisite is more strict and it requires EPiServer platform from version 7.0 (including) up to 7.1 (excluding) to avoid any incompatibility with new platform releases.

<?xml version="1.0"?>
<package >
    <title>Sharing Wigdet</title>
    <description>Enables site visitors to share the content in social networks and communities using widget.</description>
    <tags>EPiServerPublicModulePackage Social Sharing ShareThis</tags>
      <dependency id="EPiServer" version="[7.0,7.1)" />

Creating add-on package after build

Project file contains after build target which creates new add-on package every time you rebuild the project.

<?xml version="1.0" encoding="utf-8"?>
<Project ...>
<!-- ... Ommited project file content ... -->

  <Target Name="CreateAddOnPackage">
    <Exec Command="&quot;$(NuGetExePath)&quot; pack $(ProjectFileName) -OutputDirectory $(OutDir)" Condition="Exists('$(NuGetExePath)')" />
  <!-- Creating add-on package after build. -->
  <Target Name="AfterBuild">
    <CallTarget Targets="CreateAddOnPackage" />

NuGet command line tool should be placed in Dependencies folder on solution root level.

Tags: EPiServer, Add-Ons, ShareThis, Social


  • Gravatar image

    ganesh Link

    Just the information I was looking for. Thanks for the detailed instructions. I haven’t used it yet but I guess the time has come.

    I have a question about UiPath.
    Is UiPath the Server RPA?
    If I want to use the Robot multiple computers.
    So, can I use these workflows by Orchestrator?
    If you have any ideas, please tell me how these workflows do on some computers.
    I want to know about the server RPA.

    Anyways great write up, your efforts are <a href=""> much</a> appreciated.
    Thank you,

  • Gravatar image

    Renina Link

    Hi There,

    Nice tutorial! Let's keep our fingers crossed that this works. I would like to put this all to rest.
    I have a use case, where there are some 100 agents working on the same, what they do is they open one application and from there once they click using mouse, it opens another application, where in I need to enter few details extracted from the main page which I opened initially. Here once robot fill certain details, it allowed agent to fill certain other details and then submit the page. Now there are two issues I am facing?
    After final submit, if I go to main page and click to <a href=""> open second application </a> robot doesn’t work and I have to close the browser. Now I can’t close the browser everytime as it will ask the user to enter credentials again and again. Session should be active.
    Do I have to install uipath studio in all 100 agents across different locations to call robot?
    Note : Second point is challenge.
    Please help on this as earliest.

    Anyways great write up, your efforts are much appreciated.


  • Gravatar image

    ganesh Link

    Sain Bainuu,

    Muchas Gracias Mi Amigo! You make learning so effortless. Anyone can follow you and I would not mind following you to the moon coz I know you are like my north star.

    Main has thrown an exception
    Message: Error performing OCR: MicrosoftErrorCreateEngine
    Source: Microsoft OCR
    Exception Type: Exception
    System.Exception: Error performing OCR: MicrosoftErrorCreateEngine
    Server stack trace:
    at UiPath.Vision.OCR.OCRClient.ScrapeUsingHostService(OCRInput input, OCROptions options, CancellationToken cancelToken)
    at UiPath.Vision.OCR.OCRClient.Scrape(OCRInput input, OCROptions options, CancellationToken cancelToken, Boolean useHostProcess)
    at UiPath.Vision.UiImage.ScrapeOCR(OCROptions options, CancellationToken cancellationToken)
    at UiPath.Core.Activities.OCREngineActivity.<>c__DisplayClass36_0.b__0()
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
    at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
    Exception rethrown at [0]:
    at UiPath.Core.Activities.ScopeActivity.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
    at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
    at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
    By the way do you have any YouTube videos, <a href="">

    Uipath Training USA </a>
    would love to watch it. I would like to connect you on LinkedIn, great to have experts like you in my connection (In case, if you don’t have any issues).
    Please keep providing such valuable information.


  • Gravatar image

    Kevin Link

    Hello Duk,

    Thank you for making your blogs an embodiment of perfection and simplicity. You make everything so easy to follow.

    I think it's also important to keep in mind that your approvals might come in at a rhythm that differs greatly from your logging rhythm. This might make less of a difference if you constantly log a high number of bugs but as a part-time job it basically means that you can't count on a regular steady income. You would also have to count in sick days and holidays and certain times of the year with less work available <a href=""> Uipath Training USA </a>.
    Thanks a lot. This was a perfect step-by-step guide. Don’t think it could have been done better.


  • Gravatar image

    Radhey Link

    Hi Duk,

    What a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. <a href="">Uipath Training USA </a>

    You enquired about List or Array.
    I don't think I saw a way to access individual elements from a List without a loop.
    But there is a way to access it from an Array.
    Refer the attached screenshot.
    The Message Box command will show XYZ as that is the item on the 3rd row and 1st column.
    Thanks a lot. This was a perfect step-by-step guide. Don’t think it could have been done better.


  • Gravatar image

    Ajeeth Link

    Hi Man,

    Muchas Gracias Mi Amigo! You make learning so effortless. Anyone can follow you and I would not mind following you to the moon coz I know you are like my north star.

    test automation.(not always but in general). If they write unit tests, that will be great!
    ♦ API Testing libraries of that programming language.
    ♦ BDD support of that language. <a href=""> UiPath Training USA</a>

    ♦ Visual Test Automation support.
    I am in a .NET house but I changed the test automation language from C# to JAVA. Because of above reasons. In addition, when you want to search test automation experts, you can find JAVA experienced test automation experts much easily in our region. If you are a manager or decision maker, you should also consider this too.
    But great job man, do keep posted with the new updates.


  • Gravatar image

    Krishna kumar Link

    Hi Bru,

    I love all the posts, I really enjoyed.
    I would like more information about this, because it is very nice., Thanks for sharing.

    . Whenever considering whether a test should be automate, there's always a few element to be considered and 1 critical evaluation should be done.
    1. Evaluate the benefits of automating the test case, commonly you would automate Regression type test case. Have your manual test case documented and categorized into different type, such as Regression Test, Unit Test, System Test, and Exploratory Test.
    2. The effort in automating the test case.
    3. The criticality of the test case. (Prioritize it, high critical test case definitely get to automate first)
    Most important, do your <a href=""> UiPath Training USA </a>
    maths before starting the automation.

    Thank you very much and will look for more postings from you.

    Thank you,

  • Gravatar image

    Krishna kumar Link


    Great info! I recently came across your blog and have been reading along.
    I thought I would leave my first comment. I don’t know what to say except that I have

    I am working in test automation project, but I am little bit confused about what test should we automate. Should the automation cover all the test including GUI? Please share the experience or best practice about<a href=""> UiPath Training USA </a>
    choosing the test to automate. Any answer will be really helpful. Thank you and happy testing.
    Very useful article, if I run into challenges along the way, I will share them here.

    Thank you,

Add a Comment
  1. (used to show your gravatar; will not be published)