Link to home
Start Free TrialLog in
Avatar of poxy
poxy

asked on

Using stateserver to store global variables

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
Avatar of Thandava Vallepalli
Thandava Vallepalli
Flag of United States of America image

You can use Application to save the global variables.....

Avatar of poxy
poxy

ASKER

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

I need them to be shared across servers and applications.
ASKER CERTIFIED SOLUTION
Avatar of Jesse Houwing
Jesse Houwing
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of poxy

ASKER

Well.. not exactly what I was looking for..
Sorry, but it's the only thing available to you unless you implement your own state service
Avatar of poxy

ASKER

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
Any chance you could share that code?
Avatar of poxy

ASKER

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.
Avatar of poxy

ASKER

blah.. in the code I sent there are different sessionids and hash in the PUT and GET strings. But it should be the same.
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