Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Calling a COM component via C#(ASP .net)

Reply
Thread Tools

Calling a COM component via C#(ASP .net)

 
 
Badrinath Mohan
Guest
Posts: n/a
 
      11-11-2003
Hi All
I am accessing a COM component using C#. When i access it through the
standalone c# application it works fine.But when i call it using ASP .net
application its not working .
For example

This is my COM function..
Myfunction(int *PNINPUT ,int nsize,int *PNOUTPUT) is the com function in
the DLL.


I add the reference in my c# application

I call it in the C# application as follows
int [] pninput=new int[32];
//fill values in pninput

int [] pnoutput=new int[32];
Myfunction(ref pnInput,32,ref pnoutput);

I step into the dll and look at the function.
If its a standalone c# application it works fine .
with PNINPUT having all the values.

But when the c# client is a ASP .net the PNINPUT has only the first value
rest of the values are all junk. That is the input variable is not passed
onto the function at all,....

Could anyone please help me to solve this.

thanks and expecting ur reply
kandukondein


 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      11-12-2003
you will need to add the directive "aspcompat=true" to the page directive to
force the component to use the single threaded apartment model.

regards

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"Badrinath Mohan" <> wrote in message
news:...
> Hi All
> I am accessing a COM component using C#. When i access it through the
> standalone c# application it works fine.But when i call it using ASP .net
> application its not working .
> For example
>
> This is my COM function..
> Myfunction(int *PNINPUT ,int nsize,int *PNOUTPUT) is the com function in
> the DLL.
>
>
> I add the reference in my c# application
>
> I call it in the C# application as follows
> int [] pninput=new int[32];
> //fill values in pninput
>
> int [] pnoutput=new int[32];
> Myfunction(ref pnInput,32,ref pnoutput);
>
> I step into the dll and look at the function.
> If its a standalone c# application it works fine .
> with PNINPUT having all the values.
>
> But when the c# client is a ASP .net the PNINPUT has only the first value
> rest of the values are all junk. That is the input variable is not passed
> onto the function at all,....
>
> Could anyone please help me to solve this.
>
> thanks and expecting ur reply
> kandukondein
>
>



 
Reply With Quote
 
 
 
 
Badrinath Mohan
Guest
Posts: n/a
 
      11-12-2003
Unfortunately i was calling it from a web service and aspcompat was not
recognized there..
Fortunately
But ur idea helped me to study more on that and I got this idea of approach


Thread newThread =
new Thread(new ThreadStart(ThreadMethod));
newThread.ApartmentState = ApartmentState.STA;
newThread.Start ();
and in my Thread method i did the functionality of calling the COM
component.

It works like a charm...


thanks...
Badri




"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:O6xF$...
> you will need to add the directive "aspcompat=true" to the page directive

to
> force the component to use the single threaded apartment model.
>
> regards
>
> --
>
>
> -----------
> Got TidBits?
> Get it here: www.networkip.net/tidbits
> "Badrinath Mohan" <> wrote in message
> news:...
> > Hi All
> > I am accessing a COM component using C#. When i access it through the
> > standalone c# application it works fine.But when i call it using ASP

..net
> > application its not working .
> > For example
> >
> > This is my COM function..
> > Myfunction(int *PNINPUT ,int nsize,int *PNOUTPUT) is the com function

in
> > the DLL.
> >
> >
> > I add the reference in my c# application
> >
> > I call it in the C# application as follows
> > int [] pninput=new int[32];
> > //fill values in pninput
> >
> > int [] pnoutput=new int[32];
> > Myfunction(ref pnInput,32,ref pnoutput);
> >
> > I step into the dll and look at the function.
> > If its a standalone c# application it works fine .
> > with PNINPUT having all the values.
> >
> > But when the c# client is a ASP .net the PNINPUT has only the first

value
> > rest of the values are all junk. That is the input variable is not

passed
> > onto the function at all,....
> >
> > Could anyone please help me to solve this.
> >
> > thanks and expecting ur reply
> > kandukondein
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling an executable through a COM+ component via an asp page wanaruk@gmail.com ASP General 1 05-21-2008 01:12 PM
using client-side component keeps calling component's init Jim Hammond ASP .Net 1 11-12-2003 08:13 PM
Calling a COM component via C#(ASP .net) Badrinath Mohan ASP .Net Web Services 2 11-12-2003 05:33 PM
Calling a COM component via C#(ASP .net) Badrinath Mohan ASP .Net 2 11-12-2003 05:33 PM
Re: Calling a .NET component from a COM component remotely Soni ASP .Net 0 07-25-2003 04:33 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57