How do I pass aninstantiated class from webform to winform?

  • Thread starter Thread starter acool
  • Start date Start date
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?
 
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)
 
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)
 
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)
 
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
 
Back
Top