Object reference not set to instance of an object

Hello Friends,

i downloaded Asp.net portal starter kit 1.1 and then i downloaded aspnetportal-install-May042008 and tried very hard to add some modules and upgrade to it..finally i succeeded with it. I wanted to use it as i wanted to have master page support..

Finally i m getting run time erro in desktopdefault.aspx : System.NullReferenceException: Object reference not set to an instance of an object.

This error occurs in page_load event of desktopdefault.aspx page..below is my code where i am getting error.

 protected void Page_Init(object sender, EventArgs e) {
       
            PortalSettings portalSettings = (PortalSettings) HttpContext.Current.Items["PortalSettings"];
        
         
            if (PortalSecurity.IsInRoles(portalSettings.ActiveTab.AuthorizedRoles) == false) {
                Response.Redirect("~/Admin/AccessDenied.aspx");
            }

         
            if ((Request.IsAuthenticated == false) && (portalSettings.ActiveTab.TabIndex == 0)) {
                LeftPane.Controls.Add(Page.LoadControl("~/DesktopModules/SignIn.ascx"));
                LeftPane.Visible = true;             
            }

         
            if (portalSettings.ActiveTab.Modules.Count > 0) {

         
                foreach (ModuleSettings _moduleSettings in portalSettings.ActiveTab.Modules) {
                
                    Control parent = Page.FindControl(_moduleSettings.PaneName);

                    try
                    {
                        if (( _moduleSettings.CacheTime ) == 0)
                        {

                            PortalModuleControl portalModule = (PortalModuleControl) Page.LoadControl(_moduleSettings.DesktopSrc);

                            portalModule.PortalId = portalSettings.PortalId;
                            portalModule.ModuleConfiguration = _moduleSettings;

                            parent.Controls.Add(  portalModule); // i am getting error here..
                        }
                        else
                        {

                            CachedPortalModuleControl portalModule = new CachedPortalModuleControl( );

                            portalModule.PortalId = portalSettings.PortalId;
                            portalModule.ModuleConfiguration = _moduleSettings;

                            parent.Controls.Add(portalModule);
                        }

                    }
                    catch (Exception en)
                    {
                        
                        throw en;
                    }
                  
                    parent.Controls.Add(new LiteralControl("<" + "br" + ">"));
                    parent.Visible = true;
                }
            }
        }

 

 I really want to solve this error and wana get back to work..pls help...Tongue Tied

Regards,

Nil

 

 

 

 


Regards,
Nil
Please MARK POST AS AN ANSWER if it helps you
My Blog
0
nilsan
6/6/2008 1:30:20 PM
asp.net.portal-starter-kit 2189 articles. 0 followers. Follow

4 Replies
512 Views

Similar Articles

[PageSpeed] 13

Hiya,

Try setting a breakpoint on the problem code and see what you get out of the debugger. from the error it looks like you are trying to add a null object.

Cheers

Jorus.


--Please put "Mark as Answer" if I help you solve your problem, Thanks.
0
Jorus
6/8/2008 8:47:53 AM

 Hi,

I did everything but i am not getting where is the problem as every module is loaded in desktopdefault.aspx at runtime..it really becomes very difficult to trace to the root where problem really occurs..

I am still waiting for some solution..any help will be appreciated...Thanks a lot for replying me..

Regards,

Nil
 


Regards,
Nil
Please MARK POST AS AN ANSWER if it helps you
My Blog
0
nilsan
6/9/2008 7:24:48 AM

can anyone guide me on this? 


Regards,
Nil
Please MARK POST AS AN ANSWER if it helps you
My Blog
0
nilsan
6/16/2008 10:26:17 AM

 Finally i put this thing aside and started with new one..Smile

Thanks,

Nil 


Regards,
Nil
Please MARK POST AS AN ANSWER if it helps you
My Blog
0
nilsan
6/24/2008 10:54:44 AM
Reply: