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

J

justin.drerup

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
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top