Click here to Skip to main content
15,069,665 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys,
I'm working on a simple threading in a website, after a thread is completed I want to return the values returned by thread function so I want to use global variables to store it. and later I'll get the values from the global variable.I tried session,cookies but values got reset So used static but it saves the values of multiple user accessing the website is there any other possibility of global variable to be used for single user specific?Thanks in advance.

What I have tried:

hi guys,
I'm working on a simple threading in a website, after a thread is completed I want to return the values returned by thread function so I want to use global variables to store it. and later I'll get the values from the global variable.I tried session,cookies but values got reset So used static but it saves the values of multiple user accessing the website is there any other possibility of global variable to be used for single user specific?Thanks in advance.
Posted
Updated 29-Jul-16 20:45pm

1 solution

If it is ok to store the variable on the Client side you could use local storage, see:
ASP.NET and HTML5 Local Storage | Stephen Walther[^]
and: HTML5 Web Storage[^]
This will also improve performance.
   
v2
Comments
Member 11698441 2-Aug-16 0:25am
   
Can't this be Done through C# or vb.net.Is it only possible through javascript/server side?
RickZeeland 2-Aug-16 2:22am
   
It's part of HTML5, so I don't think you can use .NET commands for this.
Assuming you use ASP.NET you can put it in your webpage like this:

<script type="text/javascript">
alert( window.localStorage.getItem("message") );
</script>

Just Google for more examples if you want to use the storage variable in .NET

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900