Object reference not set to an instance of an object.
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
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.
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,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.
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.
|
[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
|
<
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
>
Hi Joel,
Could you try removing the following attribute:
defaultProvider="Aptify"
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 >>
I'm not sure that was all I needed to remove: I'm <clear>'ing the list of role providers before I add mine.
Line 71: </providers>
Line 72: </siteMap>
Line 73: <roleManager enabled="true" >
Line 74: <providers>
Line 75: <clear/>
|
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,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 >>
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
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,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 >>
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
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,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 >>
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 ?
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
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.
Hello Sonia,
So did you manage to get a workaround for this problem? Anything more we could do to help you?
All the best,I have same problem.
Did somebody got solution?
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,