Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / July 2004

Tip: Looking for answers? Try searching our database.

Calling C# COM from ASP script code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick Ruhnow - 29 Jun 2004 13:48 GMT
Hi,

i have a managed COM  component with an array as parameter like this:
public byte[] ProcessPdfDocument(string reportPath, string identifier,
string boType, string userName, bool storeDocument, string[] parameters)

Now i want to call this method out of an ASP Page (JScript) :

var bo = Server.CreateObject("DocumentProcessing.DocProcessor");
var theArray = new Array();//"12541", "de", "True");
theArray[0] = "12541";
theArray[1] = "de";
theArray[2] = "True";

var reportStream = bo.ProcessPdfDocument("/Offer/myOffer", "12541", "Offer",
"theUser", true, theArray)

Now the following error occours:
--------------------------------------
(0x800A0005)
Invalid procedure call or argument
-----------------------------------------

i tried also the MarshalAsAttribute like this:
public byte[] ProcessPdfDocument(string reportPath, string identifier,
string boType, string userName, bool storeDocument,

[MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_BSTR)]
string[] parameters)

but unfortunately without success!

thankful for every assistance

regards

Patrick Ruhnow
Chua Wen Ching - 02 Jul 2004 11:42 GMT
Hi Patrick Ruhnow,

I am not sure how you do. But this is how i simulate it in c# and vbscript.

C#:

public byte[] CallValue(string message, bool isValue)
{
char [] messageValue = message.ToCharArray();
byte [] messageByte = Encoding.ASCII.GetBytes(messageValue);
return messageByte;
}

VBScript:

<%
set myObject=Server.CreateObject("Lib.ProjectDemor")
dim test
test = myObject.CallValue("hello world", true)
Response.Write(test)
%>

Output:
?????d

Hope it helps you somehow. As I do not have your codes. Correct me if i am wrong.

Thanks.
Signature

Regards,
Chua Wen Ching :)

> Hi,
>
[quoted text clipped - 33 lines]
>
> Patrick Ruhnow

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.