5
Vote

"Object reference not set to an instance of an object" error

description

the error occurs in the index page in this line
 
<title><%=this.SiteData().SiteName %>: <%=this.CurrentPage().Title %></title>
 
becase of the error.....the main content of the page is not loaded
 
I'm missing something or doing something wrong?
Thanks in advance!

comments

MikkoK wrote Apr 18, 2009 at 5:37 AM

I had same error. What are is your PC regional setting? I had to change my settings to English.

Firetarster wrote Apr 23, 2009 at 1:42 AM

Well, Ive changed and It worked!
Pehaps you guys should check this....Or, if I had some time I
ll chwck myself and the post here the results!
Anyways...thanks in advance!

wrote Apr 30, 2009 at 7:49 PM

CaioProiete wrote Apr 30, 2009 at 8:09 PM

Hi,

This error occurs because the GetPage method of the SimpleCMSRepository class queries the Pages table for a URL and a Language Code which is being obtained through the CultureInfo class, thus using your Regional Settings definition.

The problem is that, by default, the Pages table contains only records with the English culture (en), thus if you have a different configuration in your Regional Settings, the query returns zero records which causes this error in the View.

With that said, a quick fix would be to find out what is your current culture letters (System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName), and duplicate the records of the Pages table by changing the LanguageCode field to the appropriate two letters of your current culture. Of course, another solution would be to just update the table and change the LanguageCode field.

Anyway, this error should be handled in a better way, as it is impossible to figure out what is happening without debugging the code.

Cheers,
Caio Proiete

wrote May 4, 2009 at 4:12 PM

compito wrote May 4, 2009 at 4:17 PM

Hello,

This should be handled the right way if this is to be truly "internationalized" application.
There must be a setting for the default language (english as standard) and if there is no page content (or whatever type of content) for users culture then the default language is used. That would fix this kind of problems per default so people can set up the application and start adding content in their own language as needed.

Just a thought,
Damir

wrote Jun 2, 2009 at 6:40 PM

JackNova wrote Jul 27, 2009 at 1:12 PM

I had the same error. Like other guys are saying here, all you have to do is to add a couple of lines in your web.config to set the correct culture tu use in your application:
<system.web>
  <globalization culture="en-US" uiCulture="en"/>
This allows you to run the application without doing big changes.

wrote Jul 27, 2009 at 1:13 PM

phillipthegreat wrote May 11, 2011 at 2:14 AM

Same problem also, my settings on regional settings and web.config file has already the <globalization culture="en-US" uiCulture="en"/> still problem exist.

any other suggestions to solve the issue?

wrote Feb 21, 2013 at 10:38 PM