Surendra Sharma

Surendra Sharma

Search This Blog

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.

Wednesday, February 18, 2015

Google Analytic tracking script

Google analytic is great way to track your website access and view of different pages.

Question is how to implement analytic in your web project?

To work with this you need Google tracking ID. I represented it as “NNNNN”. In project store it either in web.config or database. Below is script that you need to place it before the end of </body> section of webpage.

<script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'NNNNN']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

</script>


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

Tuesday, February 17, 2015

How to store WFFM data in SQL Server instead of SQLite database in Sitecore

When you install WFFM package, by default it store data in SQLite database.

Disadvantage with SQLite is that it creates the database on disk and it’s not centralized.
However Sitecore provides a way to store WFFM data in SQL server.

Here are the steps to do it.

·         Restore database in SQL server from “Website\Data\Sitecore_WebForms.bak
·         Change “Sitecore.forms.config” file in “Website\App_Config\Include” where comment SQLLite section and uncomment MS SQL section and put the new connection string for restored database as shown below

    <!-- DLINQ compatible data storage -->
    <!-- MS SQL -->
   
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">user id=abc;password=xyz;Data Source=your DS;Database=dbname</param>
    </formsDataProvider>
   

    <!-- Oracle -->
    <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.Oracle.OracleWFMDataProvider,Sitecore.Forms.Oracle">
      <param desc="connection string">user id=(user);password=(password);Data Source=(database)</param>
    </formsDataProvider>
    -->

    <!-- SQLite -->
       <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.SQLite.SQLiteWFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">Data Source=/data/sitecore_webforms.db;version=3;BinaryGUID=true</param>
    </formsDataProvider>-->


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

Monday, February 16, 2015

Metadata file 'HedgehogDevelopment.CodeGeneration.Extensions.dll' could not be found

If you are getting HedgehogDevelopment.CodeGeneration.Extensions.dll error in TDS Sitecore project then put HedgehogDevelopment.CodeGeneration.Extensions.dll into C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies folder for Visual Studio 2012.

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

Saturday, February 14, 2015

How to make URL in lower case in Sitecore

Sometimes client requirement is to make all letters lower case of their website URL. It’s a good practice as all search engine provide better result with lower case URL.

How to do it in Sitecore with .NET?

Sitecore is smartly provide this facility by changing just one entry in web.config file. If you want make URL in lower case then keep lowercaseUrls="true" from <linkManager defaultProvider="sitecore"> section in web.config file as highlighted below


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


Woooowww. No programming required J


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

Friday, February 13, 2015

Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies

If you are getting Sitecore WFFM error "Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies. The system cannot find the file specified."

Then check existence of "System.Data.SQLite.dll" in "Website\bin" folder.
If it’s missing then paste in "Website\bin" folder.

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

Thursday, February 12, 2015

How to check your new or modification PAN request status online

I personally feel that most of the life related work should done online. Why to visit difference government and private offices, why to meet them personally, why to call them. For a common man it’s always a difficult to go to government office and do their tasks. Government people are always showing that they are busy even they don’t have no work. Common man is always frustrated with government offices and their babus. So I always prefer to do it online.

So here I am sharing my personal experience to do changes in PAN card and how to track the request online.

If you had applied for PAN card changes like name, DOB, signature, photo etc. then you can submit your request at Karvy. You have to fill a form and attached old PAN card copy, ID proof, address proof. Submit this form along with 105 Rs. In return they will provide a receipt which has acknowledgement number. From that acknowledgement track your request status from below link


Either enter Acknowledgement number or your personal detail. Click on SUBMIT button as shown in below image and you can get the status which should be either in process or completed.




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