?
Solved

Using stateserver to store global variables

Posted on 2005-03-04
11
Medium Priority
?
290 Views
Last Modified: 2008-02-01
Hi,

I have a web that is running on 2 servers with IIS6 and webfarm.
I'm using a stateserver to store the sessions. My question is:
Is there a way to use a stateserver to store global variables?

What I was thinking was something like communicating directly with the stateserver to set and retreve data or maybe use the .net sessions to do it with a constant sessionid.

Regards,
Þorgeir
0
Comment
Question by:poxy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 14

Expert Comment

by:Thandava Vallepalli
ID: 13457815
You can use Application to save the global variables.....

0
 

Author Comment

by:poxy
ID: 13458332
quote : "Application state variables are, in effect, global variables for each ASP.NET application."

I need them to be shared across servers and applications.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Accepted Solution

by:
Jesse Houwing earned 500 total points
ID: 13459119
This is not available in .Net. Application varables will not be shared among applications, nor will they be shared among different servers on the same webfarm.

You should use a database for central settings that might change often or a Database or XML file for static configuration data.

Optionally you could use a serveractivated remoting object, but the database is probably an easier and more scalable solution
0
 

Author Comment

by:poxy
ID: 13533293
Well.. not exactly what I was looking for..
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13539698
Sorry, but it's the only thing available to you unless you implement your own state service
0
 

Author Comment

by:poxy
ID: 13540933
Well.. i got my self a packet sniffer and sniffed the commication between the asp.net and the stateserver. And found out that it is prety simple. Then I found a telnet class and succefully stored my own global variable in the stateserver. So that was what I was looking for. But you got the point for being closest.
Best regards, Thorgeir
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13542483
Any chance you could share that code?
0
 

Author Comment

by:poxy
ID: 13544117
Sure:
----------------------------------------
Innn.Lisa.Misc.TelnetClient telnet = new Innn.Lisa.Misc.TelnetClient("213.176.158.9",42424,2);

telnet.Connect();

string command = "PUT //LM/W3SVC/1/Root(Mb1OOYGzF/lgC6PvuXxHDJHt5lc=)/uutcvk552h51wz55203p5nmo HTTP/1.1\r\n";
command += "Host: 213.176.158.9\r\n";
command += "Timeout:60\r\n";
command += "Content-Length:3\r\n";
command += "\r\n";
command += "123";
command += "\r\n\r\n";

telnet.SendMessage(command);

//telnet.SendMessage("GET //LM/W3SVC/1/Root/lisa(syXS+0BN87ddXql4EvLGmiLYco8=)/5p2v1l450iuc3hzj1phi4hbk HTTP/1.1\r\n\r\n",true);
//Response.Write(telnet.WaitFor("200 OK","\n"));
//Response.Write(telnet.WaitFor(2));

telnet.Disconnect();
--------------------------------------------------------------

the sessionid is this : 5p2v1l450iuc3hzj1phi4hbk
and this is some sessionid hash : syXS+0BN87ddXql4EvLGmiLYco8=

I have yet to figure out how I can generate this hash but I thik it's ok to use some old sessionid & hash.
You can test this out by using the windows telnet client and past the commands in it.
0
 

Author Comment

by:poxy
ID: 13544181
blah.. in the code I sent there are different sessionids and hash in the PUT and GET strings. But it should be the same.
0
 
LVL 17

Expert Comment

by:Jesse Houwing
ID: 13548385
Thanx!

The hash seems to be a base64 encoded string. It can probably be any text generated at startup of the application, or fixed in the application_start
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question