Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7677801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:30:18+00:00 2026-05-31T17:30:18+00:00

I have the following two interfaces: public interface IMembershipProvider { object Login(ILoginProviderParameters loginParameters); void

  • 0

I have the following two interfaces:

public interface IMembershipProvider
{
    object Login(ILoginProviderParameters loginParameters);
    void SetAuthCookie(string userName, bool createPersistentCookie);
}

public interface IFacebookMembershipProvider : IMembershipProvider{}

and an implimentation:

public class FacebookMembershipProvider: IFacebookMembershipProvider
{
    public object Login(ILoginProviderParameters loginParameters)
    {
        // Facebook login code is here
    }

    public void SetAuthCookie(string userName, bool createPersistentCookie)
    {
        FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
    }
}

This is being injected into my controller and assigned to:

private readonly IFacebookMembershipProvider _facebookMembershipProvider;

I’m able to call the Login method without any issue however when I call the SetAuthCookie method:

_facebookMembershipProvider.SetAuthCookie(user.id, false);

I receive the error:

MyNamespace.UserManagement.Interfaces.IFacebookMembershipProvider’
does not contain a definition for ‘SetAuthCookie’

What am I doing differently with the Login method that I’m not doing with the SetAuthCookie method?

Explicitly casting to the type IMembershipProvier works just fine:

((IMembershipProvider)_facebookMembershipProvider).SetAuthCookie(user.id, false);

I’ve probably just missed something rudimentary. Thanks for taking a look.

UPDATE

In response to Marks question, the first parameter being passed to the SetAuthCookie method comes from a dynamic object.

dynamic user = _authorizeUserCommand.Invoke(_authorizeUserParams);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:30:19+00:00Added an answer on May 31, 2026 at 5:30 pm

    The curse of dynamic (comments)! Dynamic bleeds. In particular, as soon as you involve dynamic in an expression, the entire thing is performed with dynamic rules, which introduces subtle changes into a number of points.

    My advice: resolve the value first:

    string id = user.id; // this has an implicit cast to string
    _facebookMembershipProvider.SetAuthCookie(id, false);
    

    which should work fine. You could also use:

    _facebookMembershipProvider.SetAuthCookie((string)user.id, false);
    

    since the explicit cast should end the dynamic part of the expression at the argument, so the invoke is not dynamic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two interfaces: public interface ParsedFile<K, V extends FileEntry>{...} And public
I have two interfaces like these: public interface IMyInterface1 { string prop1 { get;
I have the following two classes: public class Address { public string AddressLine1 {
I have an interface (called Subject ) that has the following method: public void
Consider the following example. I have an interface MyInterface, and then two abstract classes
I have the following two classes, one inherits from the other Class A{ void
Given the following two interfaces (these are small examples, not my actual implementation): public
Using Ninject 2.2, I have the following failing test (simplified): public interface IGenericView<T> {
I have the following two methods on an interface for my service layer: ICollection<T>
I have the following base interface public interface IBaseAction { bool CanAct(...) } and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.