Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Best way to store state on the server?

Reply
Thread Tools

Best way to store state on the server?

 
 
Robin Mark Tucker
Guest
Posts: n/a
 
      05-26-2006
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














 
Reply With Quote
 
 
 
 
Josh Twist
Guest
Posts: n/a
 
      05-26-2006
You could store the has in SessionState on the server. That would
probably be an ideal solution as each proxy would represent a session.

Josh
http://www.thejoyofcode.com/

 
Reply With Quote
 
 
 
 
Robin Mark Tucker
Guest
Posts: n/a
 
      05-31-2006

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.



"Gaurav Vaish (EduJini.IN)" <> wrote in
message news:...
> Wondering if the proxy created caches/passes the Cookies sent by the
> web-service server?
>
> --
> Happy Hacking,
> Gaurav Vaish
> http://www.mastergaurav.org
> http://www.edujini.in
> -------------------
>
>
> "Josh Twist" <> wrote in message
> news: oups.com...
>> You could store the has in SessionState on the server. That would
>> probably be an ideal solution as each proxy would represent a session.
>>
>> Josh
>> http://www.thejoyofcode.com/
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy way to store page state for later requests. Shadow Lynx ASP .Net 7 02-24-2006 03:50 AM
Best way to store a time? Tarun Mistry ASP .Net 1 02-22-2006 12:33 PM
Best way to store a large number of files? heather.fraser@gmail.com Java 13 10-10-2005 01:11 PM
Best way to load/store web site settings in database Max ASP .Net 2 12-08-2003 10:39 PM
best way to store dig.photo just_a_girl41 Digital Photography 1 08-22-2003 12:25 PM



Advertisments