1. Session
2. Verification Code
YZM. ashx
Copy codeThe Code is as follows:
<% @ WebHandler Language = "C #" Class = "YZM" %>
Using System;
Using System. Web;
Public class YZM: IHttpHandler, System. Web. SessionState. IRequiresSessionState
{
Public void ProcessRequest (HttpContext context ){
Context. Response. ContentType = "image/JPEG ";
Using (System. Drawing. Bitmap bitImage = new System. Drawing. Bitmap (130,100 ))
{
// Set the canvas
Using (System. Drawing. Graphics g = System. Drawing. Graphics. FromImage (bitImage ))
{
// Random Number
Random my_random = new Random ();
Int num_01 = my_random.Next (100 );
Int num_02 = my_random.Next (100 );
Int result = num_01 + num_02;
String num_string01 = num_01.ToString ();
String num_string02 = num_02.ToString ();
String result_string = result. ToString ();
// Save it to the sessionid of the server
HttpContext. Current. Session ["YZM"] = result_string;
// Set text
G. DrawString (num_string01 + "+" + num_string02 + "? ", New System. Drawing. Font (" ", 20), System. Drawing. Brushes. Red, new System. Drawing. PointF (0, 0 ));
// Save it to the output stream
BitImage. Save (context. Response. OutputStream, System. Drawing. Imaging. ImageFormat. Jpeg );
}
}
}
Public bool IsReusable {
Get {
Return false;
}
}
}
YZM. aspx
Copy codeThe Code is as follows:
<Form id = "form1" runat = "server">
<Div>
<% -- Click Refresh verification code -- %>
</Div>
<Asp: TextBox ID = "TextBox1" runat = "server" text = ""> </asp: TextBox>
<Asp: Button ID = "Button1" runat = "server" onclick = "button#click" Text = "Button"/>
</Form>
3. http protocol
4. click the button to implement the hyperlink submission form for the effect of deleting the regular expression row
5. web development principles
6. XSS vulnerabilities
Label is similar to the control: Literal control. If the value of text in the property is <a href = "www.baidu.com"> hah </a>, the link can be embedded,
You can set the mode attribute to Encode.
7. virtual directory ~ : Used in ASP.net, always starting under the application root directory