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

  • Home
  • SEARCH
  • 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 3217948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:28:14+00:00 2026-05-17T15:28:14+00:00

I’m working on a project that’s a .NET extension to a rather large classic

  • 0

I’m working on a project that’s a .NET extension to a rather large classic ASP project, using a lot of C++ COM objects that have been around in our code base forever. Unfortunately, there’s a lot of hack-ish code on the C++ side, and I fear that I’m not experienced enough to work out the problem I’ve encountered.

In a nutshell, I can instantiate the COM object in question and Visual Studio tells me that I should be able to make calls to its “methods” (in quotes because they’re actually exposed as parameterized properties). However, any method I try to call gives me the error “Indexed property ‘CoreAspLib.IComUser.LoginUser’ has non-optional arguments which must be provided.” The thing is, I’m using the exact same parameters that were used back in the classic ASP world, and even the IntelliSense help for the properties tells me I’m using the right set of parameters. For example, the “LoginUser” property’s signature is “dynamic IComUser.get_LoginUser(string username, string password)” and I’m calling it with two strings, but I still get the “non-optional arguments” error.

Here’s some relevant code – first, the class where I’m trying to make the method call. CComUtils is a helper class that just takes the COM’s GUID and a reference to the target object, creates an instance of the desired COM object, and assigns the target reference to the new object.

public static class CurrentUser
{
    public static void Authenticate(string userName, string password)
    {
        CoreAspLib.ComUser userObject = Cache.Request<CoreAspLib.ComUser>("UserComObject");

        if (userObject == null) {
            Guid userGuid = new Guid("BF748C0A-450D-4EAF-8C39-A36F6B455587");
            CComUtils.CreateCOMInstance(userGuid, ref userObject);
            Cache.Request("UserComObject", userObject);
        }

        var result = userObject.LoginUser(sUserName:"foo", sPassword:"bar");

        if (result.Failed) {
            throw (new System.Security.Authentication.InvalidCredentialException("Bad username or password".tr()));
        } else {
            FormsAuthentication.SetAuthCookie(userName, false);
        }
    }
}

Here’s the actual method signature from the COM object’s source:

STDMETHODIMP CComUser::get_LoginUser(BSTR bsUserName, BSTR bsPassword, IDispatch ** pResult)

Here’s the interface definition from the IDL:

[
    object,
    uuid(1F4D8A57-BDE1-4D47-A9BC-5F541A0ED184),
    dual,
    nonextensible,
    helpstring("IComUser Interface"),
    pointer_default(unique)
]
interface IComUser : IDispatch{
    [propget, id(1), helpstring("property LoginUser")] HRESULT LoginUser([in] BSTR sUserName, [in] BSTR sPassword, [out, retval] IDispatch ** pResult);
    [propget, id(2), helpstring("property m_nUserID")] HRESULT m_nUserID([out, retval] ULONG* pVal);
    [propget, id(3), helpstring("property m_nUserRightsMask")] HRESULT m_nUserRightsMask([out, retval] ULONG* pVal);
    [propget, id(4), helpstring("property SetPassword")] HRESULT SetPassword([in] BSTR sPassword, [in,optional] VARIANT nUserID, [out, retval] IDispatch ** pResult);
    [propget, id(6), helpstring("property VerifyLdapCredentials")] HRESULT VerifyLdapCredentials([in]BSTR sUserName, [in]BSTR sPassword, [in]BSTR sLdapServer,[in]ULONG nLdapPort,[in]BSTR sAuthorizeDn,[in]VARIANT_BOOL bSecure, [out, retval] IDispatch ** pResult);
    [propget, id(7), helpstring("property CreateUser")] HRESULT CreateUser([in] BSTR sUserName, [in] BSTR sPassword, [in]ULONG nUserRightsMask, [in] ULONG nAuthenticationType, [in] ULONG nHomeGroupID, [in] ULONG nLanguageID, [out, retval] IDispatch** pVal);
    [propget, id(8), helpstring("property m_nLanguageID")] HRESULT m_nLanguageID([out, retval] ULONG* pVal);
};

And finally, here’s the coclass definition:

[
    uuid(BF748C0A-450D-4EAF-8C39-A36F6B455587),
    helpstring("ComUser Class")
]
coclass ComUser
{
    [default] interface IComUser;
};

What should I do?

Edit: I should mention that I wasn’t initially using named parameters; I just tried that in my efforts to make the error go away.

  • 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-17T15:28:15+00:00Added an answer on May 17, 2026 at 3:28 pm

    Hmm, your code suggest that you do in fact use C# 4.0 since you’re using named parameters. That version does support indexed properties in COM interop scenarios. Indexer syntax however requires [square brackets]. No idea if it still works with more than one argument, the examples all have just one. Try this first:

     var result = userObject.LoginUser["foo", "bar"];
    

    Or punt the problem with:

     var result = userObject.get_LoginUser("foo", "bar");
    

    Please let us know what you find out, I’m interested to learn if indexed properties with multiple arguments is supported.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.