How do I pass aninstantiated class from webform to winform?

A

acool

I want the ability to fill in the public properties of a given class in a
webform pump that class into a session variable and then recreate a new
instance of that class in order to grab those same properties. The only
thing that has me stumped is how to grab the appropriate session object in
order to grab th right class. Can this be done or is there a better way to
do this?
 
R

Raterus

I don't really understand what you are trying to do, or how this has anything to do with winforms.

if you need to put a object into the session and then pull it out, this should do it

dim myObj as ClassA = new ClassA
Session("something") = myObj
...
Dim anotherObj as ClassA
anotherObj = CType(Session("something"), ClassA)
 
R

Rick Spiewak

You can store an arbitrary class in a session variable, and then recover it
by casting it back into the class:
dim foo1,foo2 as foo
Session("foo") = foo1
..
..
foo2 = directcast(Session("foo"),foo)
 
A

acool

I am putting it in a session in a webform and then in a another winform I am
trying to pull it out of session.



I don't really understand what you are trying to do, or how this has
anything to do with winforms.

if you need to put a object into the session and then pull it out, this
should do it

dim myObj as ClassA = new ClassA
Session("something") = myObj
...
Dim anotherObj as ClassA
anotherObj = CType(Session("something"), ClassA)
 
M

Mark Travis

I dare say you will need to pass a serialised version of the object via http
to the windows application. You can call the web application from the
windows application by using the System.Net.HttpWebRequestRequest object..

I suggest you either pass the serialised object as an xml data island within
a html page and parse the page for the xml or change the response
mimetype/contenttype to xml and pass back the serialised object by itself.

I hope this is enough to get you started

Regards

Mark Travis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top