The project was completed in the early stage and started to work on the background. The pressure was lower and more time was needed to study new things.
The verification code is not a new thing. I never figured out what was going on. I used it when I used GDI the other day.
Background of the login pageCode, Use sleep to set the refresh latency
Private Void Page_load ( Object Sender, system. eventargs E)
{
If ( ! This . Ispostback)
{
System. Threading. thread. Sleep ( 1000 );
Char [] Source = ( " Abcdefghijklmnopqrstuvwxyz1234567890 " ). Tochararray ();
String Code = "" ;
Random RND = New Random ();
For ( Int I = 0 ; I < 4 ; I ++ )
Code + = Source [RND. Next (source. Length - 1 )];
Session [ " Code " ] = Code;
}
}
Login verification Private Void Btnlogin_click ( Object Sender, system. eventargs E)
{
If (Txtcode. Text. tolower () ! = Session [ " Code " ]. Tostring (). tolower ())
{
Response. Write ( " <SCRIPT> alert (\ " Incorrect verification code \ " ) </SCRIPT> " );
Response. Write ( " <SCRIPT> window. navigate (\ " Index. aspx \ " ) </SCRIPT> " );
Return;
}
If (Txtusername. Text = " Username " && Txtpassword. Text = " Password " )
{
Session [ " Username " ] = Txtusername. text;
Response. Redirect ( " Next Page " );
}
Response. Write ( " <SCRIPT> alert (\ " Incorrect password \ " ) </SCRIPT> " );
Response. Write ( " <SCRIPT> window. navigate (\ " Index. aspx \ " ) </SCRIPT> " );
}
The front-end still uses an IMG Server Object URL as code. aspx
Code. aspx. CS:
Private Void Page_load ( Object Sender, system. eventargs E)
{
If (Session [ " Code " ]. Tostring () ! = "" )
{
Bitmap BM = New Bitmap ( 60 , 30 );
Graphics g = Graphics. fromimage (BM );
G. drawstring (session [ " Code " ]. Tostring (), New System. Drawing. Font ( " " , 20 ), New Solidbrush (color. whitesmoke ), 0 , 0 );
BM. Save (response. outputstream, system. Drawing. imaging. imageformat. GIF );
}
}
OK.