Hi
From what I understand, you can pass arrays from classic ASP to .NET using
interop, but you have to change the type of the.NET parameter to object.
This seems to be because classic ASP passes a variant containing an array,
and interop expects a parameter of type object if you are passing a variant
(you are expected to cast it to the correct type in your code). I'd like to
find a way of passing arrays so that you don't need to change the types of
all arrays to object in method signatures - since this throws away compile
time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a type
library, ASP queries the CCW for type information - although what is
returned can be changed by overriding the correct method(s) in the object's
IReflect interface).
We have come up with a number of ideas which include writing a wrapper class
which customises IDispatch by overriding IReflect, but does anyone have a
simpler solution? Are there any commercial components which can solve this
problem? We also considering using web services but I don't think that we
would get the same OO semantics using this approach, would we? We could
write a simple .NET wrapper class for each .NET class or we could add extra
methods to the original class in order to solve this problem. Writing a
wrapper object in COM has also been considered, as has passing the data as a
string (which would not be very transparent, it would be inefficient). We
also considered writing our own collection classes which we would us instead
of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark 3 3784
I'm afraid you're way off. ASP and ASP.Net are 2 different technologies.
There is no interop that you can use to communicate between the 2. They live
in different application domains; different processes, different memory
spaces. The only way an ASP app can talk to an ASP.Net app (or vice versa)
is via HTTP. That is, you can send an HTTP request from one to the other,
passing data in the form of Query String or Form Post. Well, you could have
one write to a file or database as well, and have the other read it.
Interop is used for DLLs, COM objects, Windows API calls, etc.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Mark" <co***@testmail .com> wrote in message
news:eK******** *****@TK2MSFTNG P11.phx.gbl... Hi
From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes a variant containing an array, and interop expects a parameter of type object if you are passing a
variant (you are expected to cast it to the correct type in your code). I'd like
to find a way of passing arrays so that you don't need to change the types of all arrays to object in method signatures - since this throws away compile time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a
type library, ASP queries the CCW for type information - although what is returned can be changed by overriding the correct method(s) in the
object's IReflect interface).
We have come up with a number of ideas which include writing a wrapper
class which customises IDispatch by overriding IReflect, but does anyone have a simpler solution? Are there any commercial components which can solve this problem? We also considering using web services but I don't think that we would get the same OO semantics using this approach, would we? We could write a simple .NET wrapper class for each .NET class or we could add
extra methods to the original class in order to solve this problem. Writing a wrapper object in COM has also been considered, as has passing the data as
a string (which would not be very transparent, it would be inefficient). We also considered writing our own collection classes which we would us
instead of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark
I haven't tried it, but I'm pretty sure you can write a Class Library in
..NET, register it as a COM object, and call it from ASP.
If VB6 can call a .NET library, I see no reason why ASP couldn't either.
--Matthew W. Jackson
"Kevin Spencer" <ke***@takempis .com> wrote in message
news:ul******** ******@TK2MSFTN GP09.phx.gbl... I'm afraid you're way off. ASP and ASP.Net are 2 different technologies. There is no interop that you can use to communicate between the 2. They
live in different application domains; different processes, different memory spaces. The only way an ASP app can talk to an ASP.Net app (or vice versa) is via HTTP. That is, you can send an HTTP request from one to the other, passing data in the form of Query String or Form Post. Well, you could
have one write to a file or database as well, and have the other read it.
Interop is used for DLLs, COM objects, Windows API calls, etc.
-- HTH, Kevin Spencer .Net Developer Microsoft MVP Big things are made up of lots of little things.
"Mark" <co***@testmail .com> wrote in message news:eK******** *****@TK2MSFTNG P11.phx.gbl... Hi
From what I understand, you can pass arrays from classic ASP to .NET
using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes a variant containing an
array, and interop expects a parameter of type object if you are passing a variant (you are expected to cast it to the correct type in your code). I'd like to find a way of passing arrays so that you don't need to change the types
of all arrays to object in method signatures - since this throws away
compile time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a type library, ASP queries the CCW for type information - although what is returned can be changed by overriding the correct method(s) in the object's IReflect interface).
We have come up with a number of ideas which include writing a wrapper class which customises IDispatch by overriding IReflect, but does anyone have
a simpler solution? Are there any commercial components which can solve
this problem? We also considering using web services but I don't think that
we would get the same OO semantics using this approach, would we? We could write a simple .NET wrapper class for each .NET class or we could add extra methods to the original class in order to solve this problem. Writing a wrapper object in COM has also been considered, as has passing the data
as a string (which would not be very transparent, it would be inefficient).
We also considered writing our own collection classes which we would us instead of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark
Hi.
As I read you mail, what you want to do is call a compont written in .NET
from an ASP page?
First of all, your .NET component would have to be registered as a COM
component. That's quite easy if you're familiar with COM.
Regarding how to write the interface for your class so that ASP can
understand the class, you might be able to define your method like this
void method( object[] args )
but you surely can't do this
void method( int[] args )
The reason is that, as you wrote, ASP passes a variant containing an array.
But to be more specific, ASP can only operate on arrays, if they are arrays
of variants. It can't handle arrays of ints, strings or any other type.
This can only be handled by passing an array of variants where each variant
actually contains an int or a string.
Other COM aware languages, e.g. VB6 or C++, don't have any problems
operating on arrays of integers or strings, but ASP ( or VBScript to be
precise ) can't.
If you decide to go down the path of creating a .NET component to be used by
ASP, I suggest that you create a wrapper class that converts data as needed
and then call the sspecific strongly typed method on the real component
Pete
"Mark" <co***@testmail .com> wrote in message
news:eK******** *****@TK2MSFTNG P11.phx.gbl... Hi
From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes a variant containing an array, and interop expects a parameter of type object if you are passing a
variant (you are expected to cast it to the correct type in your code). I'd like
to find a way of passing arrays so that you don't need to change the types of all arrays to object in method signatures - since this throws away compile time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a
type library, ASP queries the CCW for type information - although what is returned can be changed by overriding the correct method(s) in the
object's IReflect interface).
We have come up with a number of ideas which include writing a wrapper
class which customises IDispatch by overriding IReflect, but does anyone have a simpler solution? Are there any commercial components which can solve this problem? We also considering using web services but I don't think that we would get the same OO semantics using this approach, would we? We could write a simple .NET wrapper class for each .NET class or we could add
extra methods to the original class in order to solve this problem. Writing a wrapper object in COM has also been considered, as has passing the data as
a string (which would not be very transparent, it would be inefficient). We also considered writing our own collection classes which we would us
instead of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim Hubbard |
last post by:
It seems that Microsoft not only does not need the classic Visual Basic
developer army (the largest army of developers the world has ever seen), but
now they don't need ANY Windows developer at a small or mid-sized business.
http://groups-beta.google.com/group/microsoft.public.msdn.general/browse_thread/thread/9d7e8f9a00c1c7da/459ca99eb0e7c328?q=%22Proposed+MSDN+subscription+changes%22&rnum=1#459ca99eb0e7c328
Damn! To be that...
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of code...
TCHAR myArray;
DoStuff(myArray);
|
by: Rhek |
last post by:
Hello,
I have just moved an ASP Classic website to a new hosting company that has a
number of .NET components available. The website works fine after the move
with one exception. We were creating PDFs using ASPPDF for ASP but now it
looks like only ABCPDF.NET is available.
My knowledge of ASP.NET is very limited at this time and I am planning on
converting the site to ASP.NET soon but I really need to get the PDF working
as soon as I...
|
by: Alfredo Magallón Arbizu |
last post by:
Hello,
I need to pass the contents of a dataset to the client in order to use these
contents with javascript.
What is the best way to achieve that?
Normally I use controls like a grid or text boxes and then I read the values
using javascript objects.
|
by: Alexander |
last post by:
Stituation:
-----------------------
1) COM+ application with .NET components (using regasm, interfaces
etc.)
2) ASP (classic) creates an instance of a object using
Server.CreateObject. The instance is of type ClassA (.NET object). This
is a normal class having some properties. Some properties will be set
in ASP
3) ASP (classic) creates an instance of a object using
Server.CreateObject. The instance is of type ClassB (.NET object). Then
| |
by: academic |
last post by:
When I declare a reference variable I initialize it to Nothing.
Now I'm wondering if that best for String variables - is "" better?
With Nothing I assume no memory is set aside nor GC'ed
But with "" it is - correct?
The system seems to handle a null the same as "".
|
by: Anil Gupte |
last post by:
I am having a problem using Multidim arrays. I want to create an array
which as I understand it is dimensioned as:
dim xyz (rows,columns) as String
I want to populate it with rows from a table in a database. I don't know
how many rows I am getting so of course I have to Redim inside the loop that
does this.
Unfortunately, the error message and documentation say: "In a
|
by: antonyliu2002 |
last post by:
We are extending a web application written in classic ASP long time
ago. We will add more components to this web application in ASP.NET
2.0.
To use the web application, our web users will have to log in with
their user name and password.
Well, instead of adding components to the existing classic ASP web
application, we could have just put the extended components into a new
web application. But then this would require them to log...
|
by: Garg |
last post by:
Hi All,
I am facing one problem if you are having any solution please tell me.
I have to pass an array from javascript to servlet. for this i created
one array and pass that through submitting the form with post method
and i am using request.getParameterValues to get that array. But i am
getting values in the first position of that array and that also comma
separated so that also of no use for me.
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |