Best way to store state on the server?

R

Robin Mark Tucker

Hi,

How can I store state on the server for each instance of a proxy I use on my
client?


For example if I have, say, as hash table in my services.vb class, with a
web method that creates it:

private m_Hash As Dictionary(Of String, Integer)

<WebMethod()> _
Public Sub CreateHash()

m_Hash.Clear()
m_Hash = new Dictionary(Of String, Integer)

End Sub

<WebMethod()> _
Public Sub AddToHash(ByVal theString as String, ByVal theInteger As
Integer)

m_Hash.Add ( theString, theInteger)

End Sub



and then in my client application, instantiate the generated proxy class:



Dim m_Proxy As New MYSERVICE.service

m_Proxy.CreateHash ()
m_Proxy.AddToHash ( "Example", "1" )


Will the hashtable created in the service when "CreateHash" is executed
still be there when "AddToHash" is executed? As m_Proxy is client side, I'm
wondering if an instance of the service class on the server exists for as
long as it does. What is the "best" practice way to store state like this?

Thanks



Robin Tucker
 
R

Robin Mark Tucker

Well I decided to do what Josh said and used session variables. It's quite
handy because I'm able to dump "object" into it, rather than previously in
my (ancient) experience, just strings.
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top