More in this section

Forums / Developing with Sitefinity / ArrayList Profile Property - Deserialization failing?

ArrayList Profile Property - Deserialization failing?

2 posts, 0 answered
  1. Zeke
    Zeke avatar
    4 posts
    03 Oct 2008
    22 Jan 2009
    Link to this post
    In my web.config I have a profile property defined as such:

    <add name="PreferredEventTags" type="System.Collections.ArrayList" serializeAs="Binary" />

    I then refer to it using:

    ProfileCommon profile = (ProfileCommon)ProfileCommon.Create(this.Page.User.Identity.Name);

    ArrayList prefs = profile.PreferredEventTags;

    This causes a cast exception:

    Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Collections.ArrayList'.

    Source Error:

    Line 19:     public virtual System.Collections.ArrayList PreferredEventTags {
    Line 20:         get {
    Line 21:             return ((System.Collections.ArrayList)(this.GetPropertyValue("PreferredEventTags")));
    Line 22:         }
    Line 23:         set {

    Any ideas? Here is the entire <profile> block:

            <profile defaultProvider="Sitefinity" enabled="true">
                    <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/>
                    <add name="FirstName"/>
                    <add name="LastName"/>
                    <add name="PreferredEventTags" type="System.Collections.ArrayList" serializeAs="Binary" />

    For the time being I'm just going to store it as a double-pipe delimited list.
  2. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    26 Jan 2009
    Link to this post

    We are using the Microsoft's ProfileBase class for our user's profile management. The problem is that the System.Collections.ArrayList could not be cast to String. Please refer to the example at MSDN ProfileBase Article.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered