Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Are webservices persistent ?

Hi :)

I'd like to know if there is a way to make a .NET WebService persistent.  Maybe they already are though, I'm not a VS expert here :)

Here is an example of what I need.

' *** '

Private x As Integer = 0

<WebMethod()> Public Function GetNext() As Integer
   x = x + 1
   Return x
End Function

' *** '

I want to ba able to call the GetNext method a couple of times and have 1, 2, 3, 4... as results.  Is there any way I can do that ?  

Thanks :)
1 Solution
All web method calls are stateless and so they wont be able to store the previous values. The one option that i can think of is for you to get the next number always from a database thru the web method.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now