How to add DotNetNuke localization for a country.

I’ve created an SQL to add australian regions and australian currency to DNN Lists table. The task is discussed on DNN Forum.

— =============================================
— Create procedure basic template
— =============================================
— creating the store procedure
    FROM   sysobjects
    WHERE  name = N'{databaseOwner}{objectQualifier}Localization_AddAustralia’
    AND    type = ‘P’)
    DROP PROCEDURE {databaseOwner}{objectQualifier}Localization_AddAustralia

CREATE PROCEDURE {databaseOwner}{objectQualifier}Localization_AddAustralia
declare @CountryId integer
SELECT @CountryId=[EntryID] FROM {databaseOwner}[{objectQualifier}Lists]
where  [Text]=’Australia’
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’ACT’,’Australian Capital Territory’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’NSW’,’NEW SOUTH WALES’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’NT’,’NORTHERN TERRITORY’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’QLD’,’QUEENSLAND’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’SA’,’SOUTH AUSTRALIA’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’TAS’,’TASMANIA’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’WA’,’WESTERN AUSTRALIA’, @CountryId, 1)
INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
 VALUES(‘Region’,’vic’,’Victoria’, @CountryId, 1)

INSERT INTO {databaseOwner}[{objectQualifier}Lists]( [ListName], [Value], [Text], [ParentID], [Level]) –, [SortOrder], [DefinitionID], [Description])
  VALUES(‘Currency’,’AUD’,’Australian Dollars (AUD)’, 0, 0)

/*– =============================================
— example to execute the store procedure
— =============================================
EXECUTE {databaseOwner}{objectQualifier}Localization_AddAustralia

Update:cathal has a script here with additional regions for DNN3 for about 30 countries.


DotNetNuke should cache GetHostSettings calls to database.

I’ve opened SQL profiler and noticed that opening single page in DotNetNuke causes tens of calls to database. In particular opening the Admin Pages List causes more than 50 calls to  GetHostSettings SP.

They should re-design to cache the results.

Suggestions/bugs ranking on MS product feedback site

I’ve recently posted a few suggestings/bugs to MS Product Feedback site.

They have Top Bugs/Suggestions (How we rank?) section, but I found that their way to use average vote is not appropriate.

In the current approach bug with 3 users rated 5 has bigger rank, that the bug with 60 users voted with average 4.96( almost all rated as 5 and a few rated less).
Also if I want to vote for the suggesting/bug, but consider it less than 5, I could reduce average rate and subsequently overall rank, even if I want to say that the issue is important for me.

I beleive that sum of individual rates will be more appropriate. In this case bug with 3 voters will have rank 15, but bug with 60 voters will have rank about 300 and each new voter will increase rank. This approach also do not required extra consideration “bugs with less than two votes are excluded“.

The approach can be extended to provide different weight for each rate.
E.g rate 5 can have  weight 10000, rate 4 -weight 1000,rate 3 -weight 100, rate 2- weight 10, and rate 1 can have weight 1.
Using the weights 3 votes rated 5 will give rank 30000.

56 votes with rate 5 plus 4 voters with rate 4 will give total rank 564000.

This algorithm looks more fair.

I beleive that MS have good programmers to implement this algorithm.

DotNetNuke exceptions when calling GetSupportedLocales

When I running DotNetNuke 4.0.2, I sometimes (not always !?) receive System.NullReferenceException exceptions in the area related to GetSupportedLocales.

1. I’ve changed in DNNLibraryComponentsLocalizationLocalization.vb GetResource(ByVal ResourceFileRoot As String, ByVal objPortalSettings As PortalSettings, ByVal strLanguage As String) function the code to use local variable

Dim locale As Locale = GetSupportedLocales(userLanguage) ‘mnf 17/1/2006 second call returns Nothing
‘If (Not GetSupportedLocales(userLanguage) Is Nothing) AndAlso (GetSupportedLocales(userLanguage).Fallback.ToLower <> “”) Then
If (Not locale Is Nothing) AndAlso (locale.Fallback.ToLower <> “”) Then
               fallbackLanguage = locale.Fallback.ToLower ‘GetSupportedLocales(userLanguage).Fallback.ToLower
End If

2. In  DNNLibraryComponentsSharedPageBase.vb PageCulture function I’ve also added check (Not enabledLocales Is Nothing ) around For Each block


Not enabledLocales Is Nothing Then ‘MNF 18/1/2005


Each _localeCode As String In enabledLocales.AllKeys


End If ”MNF 18/1/2005

I found that the similar errors are also posted at DNN Forum here and here.

UPDATE: I was about to post the fix for the DataCache.GetCache pattern when found that it’s already done and fixed in the core code 30/1/2006.

Exception handling in DotNetNuke Container for debugging

I found another useful change in DNN core  to debug exceptions.

Function GetPortalModuleBase in LibraryComponentsSkinsContainer.vb silently catchs exception with comment

‘ module was not loaded correctly

I beleive that exception should not be catched at all, because nothing return after exception causes very unclear message

“MinMax persistance type of cookie requires a ModuleId“

but at least for debugging purposes catch should be replaced with the followning code. (UPDATE 9/6/2006: It seems that the error message fixed in DNN 3.3/4.1)

Catch exc As Exception

    ‘ module was not loaded correctly


False, exc.ToString)

End Try

It will make redundunt quite useful at the moment DNNDebug.aspx 

Don’t forget to add to the beginning of the file the line




Update: It seems that to show exception in GetPortalModuleBase is too late.

The original exception should be shown where controls are tried to load

i.e in Default.aspx.vb -function LoadSkin() ,

DNNLibraryComponentsSkinsSkin.vb -functions  LoadContainer and InjectModule.

I’ve posted this as a  suggestion to dotnetnuke support.  

Quick Start of Debugger in VS 2005 Tip required manually handle Dependencies.

Because VS 2005 seems much slower compare with VS 2003, I was very excited when read a tip , that suggested to uncheck libraries from Configuration Manager. And it really improves the speed of start up.( I don’t understand why dependency check became so slow in VS 2005)

I have DotNetNuke web site project and a few library projects, both DotNetNuke and my own.

The problem happened when I changed the code in one of the libraries. It was quite obvious that I had to re-build the library which I’ve changed.
But the web application still used the old code. After investigation I undestood that it is required to re-build all libraries in depedencies path.

For example, your Web project depends on libraries A,B,C and D, and also C depends on B and B depends on A.

If you made changes in A, you must rebuild libraries A,B,C  for changes take affect. 



DotNetNuke NavigateURL() returns FriendlyUrls, which is not always suitable.

My DotNetNuke site  has HostSetting(“UseFriendlyUrls”) = “Y”, which is generally good.

The most popular function used in DNN to generate url is NavigateURL.
However when I want to get Page Url and then add additional query parameters, NavigateURL() is not the best choice.
NavigateURL returns FriendlyUrl, and after adding extra parameters (e.g.
http://localhost/FSDNN/vKnowledgeDataEditing/tabid/59/Default.aspx?List=SubscriptionSearchInterest ) the structure of URL becomes different to what HttpModules.UrlRewrite expects.

HttpModules.UrlRewrite replaces TabId to -1 and appropriate page is not found.

The solution is to use = ApplicationURL(Tabid)


instead of NavigateURL and then add QueryString parameters manually.

Overloads of NavigateURL have AdditionalParameters parameter ,that probably was designed by DNN authors to add arbitrary query parameters.
It is possible to parse multiple QueryString parameters into array of string AdditionalParameters and then pass it to appropriate .Sample how to split QueryString into AdditionalParameters array of string is in DNN Default.aspx.vb InitializePage function.

Unfortunautely default FriendlyUrls implementation moves parameters into part of the path ,but default UrlRewrite HttpModule unable to restore them back.
I don’t have enough experience with Rewrite rules to fix it, so using ApplicationURL is a good alternative for me.