1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Object reference not set to an instance of an object.

Object reference not set to an instance of an object.

17 posts, 0 answered
  1. Vikas Bhalotia
    Vikas Bhalotia avatar
    11 posts
    Registered:
    19 Jan 2010
    19 Jan 2011
    Link to this post
    Hi,

    I am Vikas and presently evaluating sitefinity 4.0. We want to upgrade our current sitefinity version to 4.0 version. I have installed framework 4.0 on my server and deployed sitefinity project on this server. After deployment I see object reference not set to instance of the object error. I tried my best to solve it but couldn't able to figure this out.  You can also access the site using the following url for your reference
    http://94.236.101.19/proxiobeta/sitefinity

    Please help me in this regard this will help us to evaluate faster. I thank you for your help in advance.


    Best regards,
    Vikas
  2. Vikas Bhalotia
    Vikas Bhalotia avatar
    11 posts
    Registered:
    19 Jan 2010
    19 Jan 2011
    Link to this post
    I did more investigation and found that this is giving following error

    Unable to cast object of type 'System.Web.Security.RolePrincipal' to type 'Telerik.Sitefinity.Security.SitefinityPrincipal'


    You can use the following userid and password for the admin section to verify

    username: admin
    password: admin12345


    Please help.
  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    25 Jan 2011
    Link to this post
    Hello Vikas,

    Could you please let us know what kind of authentication are you using? We haven't checked the web site yet. If you are trying to use the standard membership providers, this is not possible at the moment. We will provide support for this in the Q1 release.

    All the best,
    Georgi
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    19 Aug 2011
    Link to this post
    Hi all,

    we're getting this error intermittently now that we're running 4.2. I wish I could say that I could reproduce it regularly, but I can't.

    Unable to cast object of type 'System.Web.Security.RolePrincipal' to type 'Telerik.Sitefinity.Security.SitefinityPrincipal'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Security.RolePrincipal' to type 'Telerik.Sitefinity.Security.SitefinityPrincipal'.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace: 

     

    [InvalidCastException: Unable to cast object of type 'System.Web.Security.RolePrincipal' to type 'Telerik.Sitefinity.Security.SitefinityPrincipal'.]

       Telerik.Sitefinity.Web.SiteMapBase.IsAccessibleToUser(HttpContext context, SiteMapNode node) +232

       Telerik.Sitefinity.Web.SitefinitySiteMap.IsAccessibleToUser(HttpContext context, SiteMapNode node) +67

       System.Web.SiteMapNode.IsAccessibleToUser(HttpContext context) +17

       Telerik.Sitefinity.Web.SitefinityRoute.CheckSecurity(HttpContextBase httpContext, PageSiteNode node) +53

       Telerik.Sitefinity.Web.SitefinityRoute.GetRouteData(HttpContextBase httpContext) +640

       System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +287

       System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60

       System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +86

       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148

       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



    We are using a custom role provider:

    <roleManager enabled="true" defaultProvider="Aptify">
      <providers>
        <clear/>
        <add aptifyServer="srv-sql-dev" aptifyTrusted="true" aptifyDb="Aptify" name="Aptify" aptifyWebUserID="11" type="OSCPA.Web.Providers.AptifyRoleProvider, OSCPA.Web.Providers"/>
      </providers>
    </roleManager>

    I can try to provide you any additional information you require.
    Joel
  5. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    23 Aug 2011
    Link to this post
    Hi Joel,

    Could you try removing the following attribute:

    defaultProvider="Aptify"

    Best wishes,
    Lubomir Velkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    23 Aug 2011
    Link to this post
    I'm not sure that was all I needed to remove: I'm <clear>'ing the list of role providers before I add mine.

    Server Error in '/' Application.

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: Default Role Provider could not be found.

    Source Error:

    Line 71:       </providers>
    Line 72:     </siteMap>
    Line 73:     <roleManager enabled="true" >
    Line 74:       <providers>
    Line 75:         <clear/>


  7. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Aug 2011
    Link to this post
    Hi Joel,

    What is exact version of Sitefinity that you use? We fixed an issue with the custom Role provider in Sitefinity 4.1. Back in 4.0 this was still an issue and was not supported. If you use an older version of Sitefinity, please upgrade.

    All the best,
    Lubomir Velkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    26 Aug 2011
    Link to this post
    Hi Lubomir,

    We are running 4.2.1650.0.

    I'm sorry, I wish I had better information for you. There doesn't seem to be any reason that these exceptions are thrown, however, clearing cookies seems to correct the problem.

    Thank you for your time!
    Joel
  9. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Aug 2011
    Link to this post
    Hi Joel,

    I'm glad that you solved your issue. I suppose you upgraded to 4.2 from some older version and there were some old cookies left in your browser that caused the problem.

    Best wishes,
    Lubomir Velkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  10. Joel
    Joel avatar
    40 posts
    Registered:
    30 Nov 2010
    26 Aug 2011
    Link to this post
    Hey Lumbomir,

    Is there any chance to find out why it's happening? I know clearing cookies can be a work-around, but my main goal is not to frustrate my customers. Is there anything that I could wrap in a try...catch to suppress this error?

    Thanks!
    Joel
  11. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    29 Aug 2011
    Link to this post
    Hello Joel,

    The cookie contains information for the logged principal. Prior to version 4.1 we couldn't support ASP.NET Role providers because of a bug that was overriding our SitefinityPrincipal with a RolePrincipal. We fixed this in 4.1 so it switches the RolePrincipal with our SitefinityPrincipal. But it seems that you were logged in before upgrading and the old RolePrincipal was serialized in the cookie, so after the upgrade you were considered logged in with the RolePrincipal, while the 4.1 was expecting to have a SitefinityPrincipal. This is why deleting the cookie resulted in its recreation as SitefinityPrincipal and now everything works.

    All the best,
    Lubomir Velkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  12. Sonia
    Sonia avatar
    15 posts
    Registered:
    11 Aug 2011
    09 Sep 2011
    Link to this post
    We are using Sitefinity 4.2.1650.0  with a custom roleprovider and this is still an issue

    When the roleprovider is disabled in the web.config file the logged in user has access to authenticated pages

    HOWEVER the custom roles are NOT available in the backend for use in permissioning content.

    When the roleprovider is enabled, a page that requires the user to be authenticated FALLS OVER with this error
    BUT the roles ARE NOW available in the backend for permissioning purposes

    Do you have a fix for this ?


  13. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    14 Sep 2011
    Link to this post
    Hello Sonia,

    You need to have the role provider enabled in the web.config, otherwise the roles won't be available in your backend. I wasn't able to load your site - it took way too much time, could you please check it so I can see what is going on.

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Sonia
    Sonia avatar
    15 posts
    Registered:
    11 Aug 2011
    14 Sep 2011
    Link to this post
    The problem is caused by calling your SecurityManager.AuthenticateUser in the context.AuthenticateRequest event 

    It does not fall over if called in the PostAuthenticateRequest event

    This was all done housed in a HttpModule

    However getting context.PostAuthenticateRequest to reliably fire on each request is another problem ... however we've got around this.
  15. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    16 Sep 2011
    Link to this post
    Hello Sonia,

    So did you manage to get a workaround for this problem? Anything more we could do to help you?

    All the best,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. Kairat
    Kairat avatar
    1 posts
    Registered:
    31 May 2008
    18 Jan 2012
    Link to this post
    I have same problem.
    Did somebody got  solution?

  17. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    19 Jan 2012
    Link to this post
    Hello Kairat,

    Since there are several participants in this thread and everyone seems to have different issues, could you please explain in more details what is excatly your issue?

    Greetings,
    Lubomir Velkov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
17 posts, 0 answered