Enabling Role Provider Causes Exception

Posted by Community Admin on 04-Aug-2018 20:21

Enabling Role Provider Causes Exception

All Replies

Posted by Community Admin on 20-Dec-2010 00:00

I have some working code that makes use of the System.Web.Security.Roles.Provider that requires me to enable the role provider in web.config.

I have configured the role provider thusly:

<roleManager enabled="true" defaultProvider="Sitefinity">
    <providers>
        <clear/>
        <add name="Sitefinity" type="Telerik.Sitefinity.Security.Data.SitefinityRoleProvider, Telerik.Sitefinity" />
    </providers>
</roleManager>

In my VS 2010 test project, I created a simple TestPage.aspx page with the following single statement in the Page_Load method:
protected void Page_Load(object sender, EventArgs e)
 
     bool isadmin = System.Web.Security.Roles.Provider.IsUserInRole("admin", "administrators");
 

I make this page my default start page for the project and run it. The following exception occurs before Page_Load even executes:

Type 'Telerik.Sitefinity.Security.SitefinityIdentity' in assembly 'Telerik.Sitefinity, Version=4.0.992.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.

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.Runtime.Serialization.SerializationException: Type 'Telerik.Sitefinity.Security.SitefinityIdentity' in assembly 'Telerik.Sitefinity, Version=4.0.992.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.

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:

[SerializationException: Type 'Telerik.Sitefinity.Security.SitefinityIdentity' in assembly 'Telerik.Sitefinity, Version=4.0.992.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.]
   Microsoft.VisualStudio.WebHost.Connection.get_LocalIP() +0
   Microsoft.VisualStudio.WebHost.Request.GetLocalAddress() +65
   Microsoft.VisualStudio.WebHost.Request.GetServerName() +38
   System.Web.HttpRequest.get_Url() +140
   System.Web.HttpRequestWrapper.get_Url() +11
   System.Web.UI.ControlExtensions.IsBackend(Control control) +252
   System.Web.UI.ControlExtensions.IsBackend() +25
   Telerik.Sitefinity.Web.SitefinityRoute.GetRouteData(HttpContextBase httpContext) +504
   System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +285
   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

Posted by Community Admin on 20-Dec-2010 00:00

Hello Rick,

Currently you cannot use the standard ASP.NET Role, Membership and Profile provider in Sitefinity 4.0/ Please take a look at this post.

All the best,
Ivan Dimitrov
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

This thread is closed