0

I've build a classlibrary using c# and the .net framework 3.5. In my class library there is a class called Utilities with two methods.

public string Method1(int length)
{
}

public string Method2(int length, string aStringParameter)
{
}

Now I went and build a simple asp page calling my methods. Method1 work like a charm. Method2 causes a "Type Mismatch" error. What am I missing here?

3
  • how do you call Method2? Commented Mar 21, 2009 at 13:35
  • Pls do provide details on how are you invoking the method? Are you invoking the C# assembly as an ActiveX Control ? Commented Mar 21, 2009 at 17:42
  • The error was on a stupidity on my side and ASP threw a type mismatch instead of a "Check your syntax, fool" error. What do I do now? Close this question? Commented Mar 22, 2009 at 9:19

1 Answer 1

1

Try to put

  MarshalAs(UnmanagedType.BStr)

for string type that you are passing to method2.

Here is a detailed explanation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.