Surendra Sharma

Surendra Sharma

Search This Blog

Saturday, March 7, 2015

You should purchase the right of using the "UseLocalMTA" setting first

If you are receiving Sitecore ECM (E-mail Campaign Manager ) error message You should purchase the right of using the "UseLocalMTA" setting first , the here is a way to understand its meaning with suggested trick to fix it.

ECM offers two MTA mode – Sitecore MTA and custom MTA.

I suppose Sitecore MTA is using Sitecore App center which is based on pricing model.

But in development and testing environment, we only need Custom MTA which is free and you can test in your local environment.

You can configure ECM to use your local mail server by changing a setting in ECM's config file "Sitecore.EmailCampaign.config". 

<setting name="UseLocalMTA" value="true" />

If your license file does not have the "Sitecore.AnyMTA" permission, the value of the "UseLocalMTA" setting will be considered as “False” even though you set it to “True”.

You can check the license file for “Sitecore.AnyMTA” key by explicitly opening the license.XML file Internet Explorer browser. As an alternative, you can log in to Sitecore Content Editor, click the Sitecore button on the top left corner, and select Licenses option.

If "Sitecore.AnyMTA" key is not present in your license - I suggest you contact your Sitecore sales representative to get the one that includes the required key.

Please leave your comments or share this tip if it’s useful for you.

How to find any word in string using Jquery

This is simple but very useful method in Jquery to find any word or presence of any substring in any string.

if ($('#txtSearch').val().indexOf('?') < 0)

Here if “?” is present in textbox value then indexIf() method return the position of word in string otherwise return -1 in case of not present.


Please leave your comments or share this tip if it’s useful for you.

Friday, March 6, 2015

How to access the current URL using JavaScript

Many times we need to access current URL of browser using Javascript. Suppose if there is URL like http://www.example.com/guest/index.aspx , now you can access this URL in different pieces as below

alert(window.location.protocol); // display "http:"
alert(window.location.host); // display “www.example.com"
alert(window.location.pathname); // display "guest/example.aspx"

You can get the complete and full URL by concatenating all these different parts

var currentURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;


Please leave your comments or share this tip if it’s useful for you.

Thursday, March 5, 2015

The Sitecore App Center endpoint is not set.

If you are working with Sitecore ECM (Email Campaign Manager) and getting error The Sitecore App Center endpoint is not set. Then follow below trick to solve it.

Open page http://<SitecoreInstanceName>/sitecore/admin/SetSACEndpoint.aspx and set https://apps.sitecore.net/ in Endpoint URI textbox which is nothing but Sitecore App Center endpoint and save it.

Please leave your comments or share this tip if it’s useful for you.

Tuesday, March 3, 2015

URL and query string http%3A%2F%2F converting into http%253A%252F%252

If you have encoded your URL and query string and still its not pointing to right direction i.e. http%3A%2F%2F resolving into http%253A%252F%252 then simple reason is that % sign in “http%3A” is encoding into %25 as hexa value of % is 0x25.

The solution to resolve it is don't encode your URL in this case. Directly pass URL like https://www.mysit.com


Please leave your comments or share this tip if it’s useful for you.

Sunday, February 22, 2015

How to generate Sitemap for your website online

There are situation when you are going to deploy your website on production and client want Sitemap file of website. Sitemap file is used to improve SEO results.

If you are going to create it manually, your require two things
  • If you must know all the pages name of your site
  • Time - as it’s a time taking process to create this file.

But there is good news you can create it online and within a minute. Here are the steps to do it.


- Visit website https://www.xml-sitemaps.com and enter your full website URL and some optional parameters in the form below.

- Press 'Start' button and wait until the site is completely crawled.

- You will be redirected to the generated sitemap details page, including number of pages, broken links list, XML file content and link to a sitemap file.
  Download the sitemap file using that link and put it into the domain root folder of your site.

- Go to your Google Webmaster account and add your sitemap URL.

Put this file into your virtual directory.


In case of Sitecore, put this sitemap.xml under "website" folder.

Please leave your comments or share this tip if it’s useful for you.

Thursday, February 19, 2015

Language suffix 'en' is being added into the URL of Sitecore website

Recently I come across with interesting requirement in Sitecore.

Whenever any new user tries to access any page of website first time, language suffix ‘en’ is adding into the URL. If same user tries to access the same page again then ‘en’ is not including into the URL. Let’s understand it with example.

When the user is on www.abc.com  and clicks to go to the any pages, the URL user is taken to is http://www.abc.com/en/abc , which should be www.abc.com/abc  and when user clicks LMN link, URL is http://www.abc.com/en/LMN , should be www.abc.com/LMN .

This is only occurring the first time the user visits the page. If the user clicks away from one of these pages to a different page and then clicks back to the previous page, the URL's no longer contain the 'en'.

How to fix this?

Open web.config file and locate languageLocation in linkManager section. Its different values are asNeeded, always and never. By default its asNeeded so language siffix added into the URL first time the user visits the page.
If you set Never, you will never get the language suffix in URL.

    <linkManager defaultProvider="sitecore">
      <providers>
        <clear/>
        <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" lowercaseUrls="true" shortenUrls="true" useDisplayName="false"/>
      </providers>
    </linkManager>


Please leave your comments or share this tip if it’s useful for you.