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
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
You can use Application to save the global variables.....
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.
I need them to be shared across servers and applications.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
Best regards, Thorgeir
Any chance you could share that code?
ASKER
Sure:
-------------------------- ---------- ----
Innn.Lisa.Misc.TelnetClien t telnet = new Innn.Lisa.Misc.TelnetClien t("213.176 .158.9",42 424,2);
telnet.Connect();
string command = "PUT //LM/W3SVC/1/Root(Mb1OOYGz F/lgC6PvuX xHDJHt5lc= )/uutcvk55 2h51wz5520 3p5nmo 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(syX S+0BN87ddX ql4EvLGmiL Yco8=)/5p2 v1l450iuc3 hzj1phi4hb k HTTP/1.1\r\n\r\n",true);
//Response.Write(telnet.Wa itFor("200 OK","\n"));
//Response.Write(telnet.Wa itFor(2));
telnet.Disconnect();
-------------------------- ---------- ---------- ---------- ------
the sessionid is this : 5p2v1l450iuc3hzj1phi4hbk
and this is some sessionid hash : syXS+0BN87ddXql4EvLGmiLYco 8=
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.
--------------------------
Innn.Lisa.Misc.TelnetClien
telnet.Connect();
string command = "PUT //LM/W3SVC/1/Root(Mb1OOYGz
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(syX
//Response.Write(telnet.Wa
//Response.Write(telnet.Wa
telnet.Disconnect();
--------------------------
the sessionid is this : 5p2v1l450iuc3hzj1phi4hbk
and this is some sessionid hash : syXS+0BN87ddXql4EvLGmiLYco
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.
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
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