C # obtain and send the website Session,
Request = (HttpWebRequest) WebRequest. Create (url );
If (Const. session! = Null)
{
Request. Headers. Add ("Cookie", Const. session );
}
Request. Timeout = 30000; // set the Timeout value.
Request. ContentType = "application/octet-stream ";
Request. Method = "POST ";
Request. ContentLength = outData. Length;
Stream = request. GetRequestStream ();
Stream. Write (outData, 0, outData. Length );
Stream. Flush ();
Stream. Close ();
Const. uiWaitMessage = "after the request is sent, start to receive data ";
Thread. Sleep (500 );
// Sent
// Receive data
Response = (HttpWebResponse) request. GetResponse ();
If (Const. session = null)
{// Clear Common. session after logout
String cookie = response. GetResponseHeader ("Set-Cookie ");
If (cookie! = Null)
{
Int n = cookie. IndexOf (';');
If (n>-1) Const. session = cookie. Substring (0, n );
}
}
Use
If (Const. session = null)
{// Clear Common. session after logout
String cookie = response. GetResponseHeader ("Set-Cookie ");
If (cookie! = Null)
{
Int n = cookie. IndexOf (';');
If (n>-1) Const. session = cookie. Substring (0, n );
}
}
You can obtain and save the Session information assigned by the website.
In this way, you can use
If (Const. session! = Null)
{
Request. Headers. Add ("Cookie", Const. session );
}
To add a Cookie and send the obtained Session information to the website.
C language ^ how to use
A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010
B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011
^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.
//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].
C language ^ how to use
A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010
B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011
^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.
//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].