Actualités développement .NET

Actualités DotNetNuke Pro et Communitaire et autres technologies mises en oeuvre par DevPCI.
07

When configuring your App in Google API Console, you have to declare the redirect URI. If the redirect uri doesn't match, there is an error , URI mismatch :

The login and register url are build by dnn,  in case on Mono language site, friendly human url are build in every case like that :  www.mydom.com/login.aspx?[retunUrlYouComeFrom]

But in the Multilanguage case, urls are build like that : www.mydom.com/MyPage/clt/login/language/fr-FR/Default?[ReturnUrlYouComeFrom]

With that build for multi language, the url is different for each page.

You can avoid the URI Mistmatch error by declaring all your url in your google api console.

So the idea is to build the Multi language special url in a same manner as the mono language.

Take care we will modifing dnn core code source and  rebuild dnn. So make it at your own risk (and first in a test / dev environnement)

Open DotNetNuke sources and verify it compile well in your VS.

Open file FriendlyUrlProvider.cs and after the if statement :

if (queryStringDic.ContainsKey("ctl") && !queryStringDic.ContainsKey("language"))

{

}

// add this else if statement for MultiLanguage:
else if (queryStringDic.ContainsKey("ctl") && queryStringDic.ContainsKey("language"))

{

switch (queryStringDic["ctl"].ToLowerInvariant())

{

    case "terms":

        friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/terms.aspx", portalAlias, isPagePath);

        break;

    case "privacy":

        friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/privacy.aspx ", portalAlias, isPagePath);

        break;

    case "login":

        if ((queryStringDic.ContainsKey("returnurl")))

        {

            friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/login.aspx?ReturnUrl=" + queryStringDic["returnurl"], portalAlias, isPagePath);

        }

        else

        {

            friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/login.aspx ", portalAlias, isPagePath);

        }

        break;

    case "register":

        if ((queryStringDic.ContainsKey("returnurl")))

        {

            friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/register.aspx?returnurl=" + queryStringDic["returnurl"], portalAlias, isPagePath);

        }

        else

        {

            friendlyPath = GetFriendlyAlias("~/" + (queryStringDic["language"]).ToLower() + "/register.aspx ", portalAlias, isPagePath);

        }

        break;

    default:

        //Return Search engine friendly version

        return GetFriendlyQueryString(tab, GetFriendlyAlias(path, portalAlias, isPagePath), pageName);

}

// End Else if ML

Save, rebuild, copy the dll in the appropriate dev site.

This else if statement will build these four url now like that : /fr-fr/login.aspx?[ReturnUrlYouComeFrom].

You  now only have to declare in google api console the URIs for each language, sample : http://www.mysite.com/fr-fr/login.aspx and http://www.mysite.com/fr-fr/register.aspx

PS : use culture code in lower case.