Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Custom object with a System.Web.Security.MembershipUserCollection property - "implement a default accessor" error

Reply
Thread Tools

Custom object with a System.Web.Security.MembershipUserCollection property - "implement a default accessor" error

 
 
justin.drerup@gmail.com
Guest
Posts: n/a
 
      05-20-2006
I'm tryng to return a custom object that contains a collection of
MembershipUsers through a web service however I receive the following
error when trying to return the object through a web method:

You must implement a default accessor on
System.Web.Security.MembershipUserCollection because it inherits from
ICollection.

The error appears when trying to load the WebService.asmx file. The
code builds fine.

There are quite a few posts about how to resolve this problem however
they all seem to pertain to custom collections. I am using the
MembershipUserCollection and I don't feel that I have the ability to
change how the 'out-of-the-box' version works.

Does anybody know how to resolve this?

Thanks, Justin.

ASP.NET 2.0

Here is the code for the object:

WebService.cs

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using Demo.Content;

/// <summary>
/// Summary description for ResortsService /// </summary>
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public
class ResortsService : System.Web.Services.WebService {
public WebService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public Article GetArticle()
{
Article article = new Article();
return article;
}
}


Article.cs

using System;
using System.Collections.Generic;
using System.Text;

namespace Demo.Content
{
[Serializable]
public class Article
{
private int articleID;
private string title;
private System.Web.Security.MembershipUserCollection authors;

public Article()
{ }

#region Members

public int ArticleID
{
get { return this.articleID; }
set { this.articleID = value; }
}

public System.Web.Security.MembershipUserCollection Authors
{
get { return this.authors; }
set { this.authors = value; }
}

public string Title
{
get { return this.title; }
set { this.title = value; }
}

#endregion
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding CssClass property default to custom checkbox wraps with span tag TS ASP .Net Building Controls 3 07-18-2007 02:20 AM
Binding to property of property of object collection TS ASP .Net 3 08-31-2006 12:57 PM
Custom Attributes (AttributeTargets.Property) and Property Type Zarko Gajic ASP .Net Building Controls 0 04-07-2005 02:20 PM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM
Web Custom/Composite controls default property render issue. Andrei Sinelnikov ASP .Net Building Controls 2 05-10-2004 04:27 PM



Advertisments