Error: Object reference not set to an instance of an object

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,
I have created personalized configuration sections in my web project
following the instructions described in this page
http://msdn.microsoft.com/library/s...cpcondeclaringcustomconfigurationsections.asp

The problem is that I using the same code and I get the error "Object
reference not set to an instance of an object" in the line where I try to
read the first parameter (in the page attached : value1 =
CType(sampleTable("setting1"), String)).

I have made some investigations and this error occurs when you don't create
the object with new. The problem is that in this case is not possible because
IDictionary is an interfaz.

I have also investigated that it could be a version problem, here you can
find the versions I'm using Microsoft .NET Framework, Version:1.1.4322.573
ASP.NET Version:1.1.4322.573

can you help me?

Thank you very much.

Regards,
Paloma García.
 
Paloma said:
Dear all,
I have created personalized configuration sections in my web project
following the instructions described in this page
http://msdn.microsoft.com/library/s...cpcondeclaringcustomconfigurationsections.asp

The problem is that I using the same code and I get the error "Object
reference not set to an instance of an object" in the line where I try to
read the first parameter (in the page attached : value1 =
CType(sampleTable("setting1"), String)).

I just enetered the exact code from that article and it worked fine.
Did you change the code any? Perhaps changing the section name from
sampleSection to something else? If you did, make sure that the case
matches because it is case sensitive.
I have made some investigations and this error occurs when you don't create
the object with new. The problem is that in this case is not possible because
IDictionary is an interfaz.

That is right, the sampleTable object which is an IDictionary, should
not be created with new because the ConfigurationSettings.GetConfig
method should return an IDictionary object (after casting).
I have also investigated that it could be a version problem, here you can
find the versions I'm using Microsoft .NET Framework, Version:1.1.4322.573
ASP.NET Version:1.1.4322.573

I doubt your version number has anything to do with the problem. My
suggestion would be to post the code and perhaps we can see what might
the problem be.
 
Back
Top