Conversion error in web service

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • para15000
    New Member
    • Jun 2009
    • 2

    Conversion error in web service

    Hello,

    I am working on a single sign on sollution for two different websites.
    I am trying to make the methods in my customized(over riden) provider post to a web service and get the results from it so that the same login.

    It works for most methods but there are ones that return System.We.Secur ity sp3ecific objects that fail. For example

    Code:
    public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
            {
                System.Web.Security.MembershipUser mu = null;
                iConnect.Core.iConnectWS.iConnect connect = new iConnect.Core.iConnectWS.iConnect();
                mu = ((MembershipUser)connect.GetUser(providerUserKey, userIsOnline));
                return mu;
            }
    is in the provider
    and it calls
    Code:
    [WebMethod(EnableSession = true)]
        public object GetUser(object providerUserKey, bool userIsOnline)
        {
            return (object) System.Web.Security.Membership.GetUser(providerUserKey, userIsOnline);
        }
    in the webservice
    (the webservice uses the default asp.net provider System.Web.Secu rity.SqlMembers hipProvider)

    My problem is that when I try to run this I get an error
    Code:
    Unable to cast object of type 'iConnect.Core.iConnectWS.MembershipUser' to type 'System.Web.Security.MembershipUser'
    If I don't make the web service return a object then I get this error at compilation.

    The class is the web service and the one in the one in the provider is one and the same System.Web.Secu rity.Membership User.

    Can anyone help me?
    thank you in advance
Working...