Storing state in the service.vb class?



Hi, apologies for the cross post, if you also subscribe to the
aspnet.webservices group, I'm new to asp.net so I'm still finding the
newsgroup sweet spots ;)


Anyway, my question is, 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 VB.NET (Windows Forms) 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















.



Relevant Pages

  • Re: Cant provide constructor parameters
    ... But the web service standard has no knowledge of what we are doing and is really just letting us call the individual methods in them. ... All the web service or the client knows about really are the methods in our class that we've marked with the "WebMethod" attribute and are public. ... Public Sub New(ByVal Text As String) ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Cant provide constructor parameters
    ... What I really have is a web service that receives an arraylist and I'm wanting to load that arraylist with my class object. ... if my class just defined two properties I was hoping I could do something like this on the client end... ... Public Sub New(ByVal Text As String) ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Previously Functioning Date Interpreter Now Failing
    ... Dim Entry As String ... Dim Result As String ... Dim ClientElement As Variant 'Holds the extracted Client Number ... ElseIf IsNumeric= False _ ...
    (microsoft.public.excel.programming)
  • RE: Previously Functioning Date Interpreter Now Failing
    ... Dim Entry As String ... Dim Result As String ... Dim ClientElement As Variant 'Holds the extracted Client Number ... ElseIf IsNumeric= False _ ...
    (microsoft.public.excel.programming)
  • Re: Threading a server
    ... I am getting myself into a really big hole with this and the client is a little upset. ... private TcpListener tcpListener; ... private string CurrentCommand ... public string ExpectedSubject ...
    (microsoft.public.dotnet.languages.csharp)