dzÎöASP.NETÉú³ÉËæ»úÃÜÂë(ת)
ʵÏÖASP.NETÉú³ÉËæ»úÃÜÂ빦ÄÜÊǺÜÈÝÒ׵ģ¬ÏÂÃæµÄ´úÂë¸ø³öÁËÍêÕûµÄʵÏÖ·½·¨£º
public static string MakePassWord(string PwdChars, int Pwdlen)
{
string mpstr = "";
int iRandNum;
Random mrnd = new Random();
for (int i = 0; i < Pwdlen;i++ )
{
iRandNum = mrnd.Next(PwdChars.Length);
mpstr += PwdChars[iRandNum];
}
return mpstr;
} ¶ÔÕÕÔ´Â룬½²Ò»Ï¾ßÌåµÄ˼·£º
·½·¨ MakePassword ½ÓÊÜÁ½¸ö²ÎÊý£¬pwdchars ²ÎÊýÖ¸¶¨Éú³ÉµÄËæ»úÃÜÂë´®¿ÉÒÔʹÓÃÄÄЩ×Ö·û£¬pwdlen Ö¸¶¨Éú³ÉµÄËæ»úÃÜÂë´®µÄ³¤¶È¡£ÓÐÁËÕâÁ½¸ö²ÎÊý£¬Í¨¹ýµ÷Óà Random ÀàµÄ Next() ·½·¨£¬ÏÈ»ñµÃÒ»¸ö´óÓÚ»òµÈÓÚ 0 ¶øСÓÚ pwdchars ³¤¶ÈµÄÕûÊý£¬ÒÔ¸ÃÊý×÷ΪË÷ÒýÖµ£¬´Ó¿ÉÓÃ×Ö·û´®ÖÐËæ»úÈ¡×Ö·û£¬ÒÔÖ¸¶¨µÄÃÜÂ볤¶ÈΪѻ·´ÎÊý£¬ÒÀ´ÎÁ¬½ÓÈ¡µÃµÄ×Ö·û£¬×îºó¼´µÃµ½ËùÐèµÄËæ»úÃÜÂë´®ÁË¡£
´úÂëµ÷Óà MakePassword() ·½·¨»ñÈ¡³¤¶ÈΪ 10 £¬¿ÉÓÃ×Ö·û·¶Î§Îª´óСд×Öĸ¼°Êý×ÖµÄËæ»ú×Ö·û´®¡£
string randomchars ="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string password = MakePassword(randomchars, 10); ÒÔÉÏÊÇASP.NETÉú³ÉËæ»úÃÜÂë¡£
Ïà¹ØÎĵµ£º
asp.netÖг£ÓõÄ26¸öÓÅ»¯ÐÔÄܵķ½·¨
2008-09-28 09:39
1. Êý¾Ý¿â·ÃÎÊÐÔÄÜÓÅ»¯¡¡
¡¡
Êý¾Ý¿âµÄÁ¬½ÓºÍ¹Ø±Õ
·ÃÎÊÊý¾Ý¿â×ÊÔ´ÐèÒª´´½¨Á¬½Ó¡¢´ò¿ªÁ¬½ÓºÍ¹Ø±ÕÁ¬½Ó¼¸¸ö²Ù×÷¡£ÕâЩ¹ý³ÌÐèÒª¶à´ÎÓëÊý¾Ý¿â½»»»ÐÅÏ¢ÒÔͨ¹ýÉí·ÝÑéÖ¤£¬±È½ÏºÄ·Ñ·þÎñÆ÷×ÊÔ´¡£ASP.NETÖÐÌṩÁËÁ¬½Ó³Ø(Connection Pool)¸ÄÉÆ´ò¿ªºÍ¹Ø±ÕÊý¾Ý¿â¶ÔÐÔÄܵÄÓ°Ï졣ϵ ......
if(MyFile.PostedFile.ContentType != "image/gif"
&& MyFile.PostedFile.ContentType != "image/jpg"
&& MyFile.PostedFile.ContentType != "image/pjpeg"
&& &n ......
//²¿Êð×ÀÃæ¿ì½Ý·½Ê½*******************#region//²¿Êð×ÀÃæ¿ì½Ý·½Ê½*******************
StreamWriter sw2=System.IO.File.CreateText(Context.Parameters["des"].ToString()+"WebSetupTest.url");
stateSaver.Add("DeskQuick",Context.Parameters["des"].ToString() ......
ÎÊ£ºÎªÊ²Ã´SessionÔÚÓÐЩ»úÆ÷ÉÏż¶û»á¶ªÊ§£¿
´ð£º¿ÉÄܺͻúÆ÷µÄ»·¾³ÓйØϵ£¬±ÈÈ磺·À»ðǽ»òÕßɱ¶¾Èí¼þµÈ£¬³¢ÊԹرշÀ»ðǽ¡£
ÎÊ£ºÎªÊ²Ã´µ±µ÷ÓÃSession.Abandonʱ²¢Ã»Óм¤·¢Session_End·½·¨£¿
´ð£ºÊ×ÏÈSession_End·½·¨Ö»Ö§³ÖInProc£¨½ø³ÌÄڵģ©ÀàÐ͵ÄSession¡£Æä´ÎÒª¼¤·¢Session_End·½·¨£¬±ØÐë´æÔÚSession£¨¼´ÏµÍ³ÖÐÒÑ¾Ê¹Ó ......
ASP.NET ÉúÃüÖÜÆÚ
¶ÔÓÚAsp.netÒ³Ãæ²ã¿ª·¢ÎÞÂÛÊÇдҳÃ滹ÊÇд¿Ø¼þ£¬ÎÒ¾õµÃ¶¼¿ÉÒÔÓÃÒ»¾ä»°ÃèÊö:"Do the right thing at the right time in the right place."
±¾ÎÄͨ¹ý¼Ç¼ҳÃæʼþµÄ´¥·¢Ë³Ðò¿´ÇëÇóµÄ´¦ÀíÁ÷³Ì£¬´ÓÖпÉÒÔ¿´³öASP.NET µÄÉúÃüÖÜÆÚ
´´½¨Ò»¸öÍøÕ¾£¬ÔÚÒ³ÃæÉÏÌí¼ÓÒ»¸öLabelºÍÒ»¸öButton£¬ÔÚDefault.aspx.csÖÐÐÞ¸Ä ......