?? asp.net ?? ?? ??? ?? ??? ?? ?? ??? ??? ?? ???? ???? ????. ?? ?? ?? ???? ???? ??? ASP.NET ?? ??? ??? ? ????. ? ??? ????.
?? asp.net ?? ValidateCode.aspx? ??????. ??????? ?? ?? ??? ?????. ValidateCode.aspx.cs:
protected void Page_Load(object sender, EventArgs e) { string validateCode = CreateValidateCode();//生成驗(yàn)證碼 Bitmap bitmap = new Bitmap(imgWidth,imgHeight);//生成Bitmap圖像 DisturbBitmap(bitmap); //圖像背景 DrewValidateCode(bitmap,validateCode);//繪制驗(yàn)證碼圖像 bitmap.Save(Response.OutputStream,ImageFormat.Gif);//保存圖像,等待輸出 } private int codeLen = 4;//驗(yàn)證碼長度 private int fineness = 85;//圖片清晰度 private int imgWidth = 48;//圖片寬度 private int imgHeight = 24;//圖片高度 private string fontFamily = "Times New Roman";//字體名稱 private int fontSize = 14;//字體大小 //private int fontStyle = 0;//字體樣式 private int posX = 0;//繪制起始坐標(biāo)X private int posY = 0;//繪制坐標(biāo)Y private string CreateValidateCode() //生成驗(yàn)證碼 { string validateCode = ""; Random random = new Random();// 隨機(jī)數(shù)對(duì)象 for (int i = 0; i < codeLen; i++)//循環(huán)生成每位數(shù)值 { int n = random.Next(10);//數(shù)字 validateCode += n.ToString(); } Session["vcode"] = validateCode;//保存驗(yàn)證碼 這Session是在前臺(tái)調(diào)用的。 return validateCode;// 返回驗(yàn)證碼 } private void DisturbBitmap(Bitmap bitmap)//圖像背景 { Random random = new Random();//通過隨機(jī)數(shù)生成 for (int i = 0; i < bitmap.Width; i++)//通過循環(huán)嵌套,逐個(gè)像素點(diǎn)生成 { for (int j = 0; j < bitmap.Height; j++) { if (random.Next(90) <= this.fineness) bitmap.SetPixel(i, j, Color.LightGray); } } } private void DrewValidateCode(Bitmap bitmap, string validateCode)//繪制驗(yàn)證碼圖像 { Graphics g = Graphics.FromImage(bitmap);//獲取繪制器對(duì)象 Font font = new Font(fontFamily, fontSize, FontStyle.Bold);//設(shè)置繪制字體 g.DrawString(validateCode, font, Brushes.Black, posX, posY);//繪制驗(yàn)證碼圖像 }
Login.aspx ?? ?????:
//這個(gè)函數(shù)是在點(diǎn)擊驗(yàn)證碼圖片就會(huì)更換驗(yàn)證碼 //可以使用微軟自帶的jqury.js 下面jquery-1.4.1.min.js版本之上的。或者在jquery官網(wǎng)上下載就可以。 <script src="styles/jquery-1.4.1.min.js" type="text/javascript"></script> function f_refreshtype() { var Image1 = document.getElementByIdx_x_x_x("img"); if (Image1 != null) { Image1.src = Image1.src + "?"; } } ---<img src="ValidateCode.aspx" id="img" onclick="f_refreshtype()" width="50px"/>//調(diào)用函數(shù),實(shí)現(xiàn)更換驗(yàn)證碼
??? ??: ???? ???? ???? ??? ?????.
string usercode = txtcode.Text.Trim(); if (usercode == Session["vcode"].ToString())//Session["vcode"] { }
?? ??? ?? ??? ?????.
? ??? ???? ??? ??? ASP.NET ???? ?? ?????. ?? ??? ??? ??? ????.
asp.net ???? ????? ??? ? ?? ?? PHP ??? ????? ??????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











theieldKeyWordinc#simplifiesteratorcreationBeycreationSomateAtAtAtenablesLazyEvaluation.1.ItAllOwSreturningItemSoneatAtimeUsingyieldRetrern, weeneachitem, 2.yieldBreenceCanbeus

DependencyInjection(DI)inC#isadesignpatternthatenhancesmodularity,testability,andmaintainabilitybyallowingclassestoreceivedependenciesexternally.1.DIpromotesloosecouplingbydecouplingobjectcreationfromusage.2.Itsimplifiestestingthroughmockobjectinject

C#?? idisposable? ??? ??? ???? ?? ???? ????? ????? ???? ????. 1. idisposable? dispose () ???? ???? ???? ???? ?? ???? ???? ??? ???? ?? ? ? ???; 2. ?? ???? ??? ??? ??? ?? Dispose ()? ???? ????? ???? ??? ??? ????? ??? ?????. 3.?? ??? ? ??? idisposable? ???? ?? ??? ?? ? ? ??? StreamReader? ?? ??? ?? ???????. 4. ???? ?? ???? ??, ?? ? ??? ???? ???? Dispose (BOOL) ??? ???? ?? ???? ???? ?? ?? ?????.

lambdaexpressionsandlinqsimplifydatamanipulationinc#byenablingconcise, ?? ?? ? ???? ??

NULLABLEREFERENCETYPES (NRTS) INC#8 HELPCATCHNULLREFERNEEXCEPTIONERCECTIONPILETIMEBYMAKINGERENCETYPESNON-NULLABLEBYDEFAULT.NURTSMUSTBEEBEDITHERINTHETHETHE.CSPROJFILEWITHENORATTETTETOPA.CSFILESOUN NULL

C# ???? 4 ?? ???? "??"??? ??????. ??, ???/???? ????? ??? ?? ?? ? ?? ??? ?????. ??? ?? ????? ??? ????, configureawait (false)? ???? ??? ????????. ??, VAR? ?? ??? ???? ???? ??? ??? ??? ??? ? ? ? ??? ?? ??? ???? ?????. ??, ?? ? ?? ??? ?? ???? ??? ???? ?? ???? ???? ?????? IDISPosable ?? ??? ?????????. ??, ?? ??? ?? ?? ?? ???? ?? ??? ???? ???? ??? ??, ? ?? ?? ????? ???? ????? ?? ??? ????????. ??? ??? ??? ?? ??? ?? ??? ?? ?? ? ? ????.

?? ? ???? ??? ??? ????? C# ??? ??????. 1. ??? ?? ??? ??? ?? ???? ?? ??? ??? ????, ?? ?? ????, ??? ?? ? ??? ?? ??? ?????. 2. ???? ??? ??? ?? ??? ????? ???? ?? ????, ?? ? ??? ????? ??? ????? ?????. 3. ? ? GC ??? ??? ??? ????? ?? ??? ????? ??? ??????. 4. SPAN? ???? ???? ??? ???? ???? ????? ??? ???? ??? ? ????. Calling.toArray ()? ?? ? ?? ??? ??? ????????.

??? ??? ?? ?? ?????? ?? ?? ?? ? ?? ?? ??????? 5 ?? ?? ?????. 1. SRP (Single Responsibility Principle)? ???? ??? ?? ?? ? ??? ??? ?? ??? ?? ? ????? ?????. 2. OCP (Opening and Closing Principle)? ISHAPE ?????? ???? ?? ???? ?? ??? ???? ?? ?? ?? ??? ???? ?? ????? ?? ?? ???? ?? ??? ????? ?? ?????. 3. Richter ?? ?? (LSP)? ?? ???? ??? ???? ?? ?? ???? ?? ? ? ??????. 4. ISP (Interface Displence Principle)? ?? ???? ??? ?? ?? ?? ? ?? ??? ?? ??? ?????? ??? ?????. 5. ??? ?? ?? (DIP)?
