Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#(ASP.Net)»ñÈ¡µ±Ç°Â·¾¶µÄ·½·¨¼¯ºÏ

//»ñÈ¡µ±Ç°½ø³ÌµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£  
string str = this.GetType().Assembly.Location;  
result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)  
//»ñÈ¡Ð嵀 Process ×é¼þ²¢½«ÆäÓ뵱ǰ»î¶¯µÄ½ø³Ì¹ØÁªµÄÖ÷Ä£¿éµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£  
string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;  
result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)  
//»ñÈ¡ºÍÉèÖõ±Ç°Ä¿Â¼£¨¼´¸Ã½ø³Ì´ÓÖÐÆô¶¯µÄĿ¼£©µÄÍêÈ«ÏÞ¶¨Â·¾¶¡£  
string str = System.Environment.CurrentDirectory;  
result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼)  
//»ñÈ¡µ±Ç° Thread µÄµ±Ç°Ó¦ÓóÌÐòÓòµÄ»ùĿ¼£¬ËüÓɳÌÐò¼¯³åÍ»½â¾ö³ÌÐòÓÃÀ´Ì½²â³ÌÐò¼¯¡£  
string str = System.AppDomain.CurrentDomain.BaseDirectory;  
result: X:\xxx\xxx\ (.exeÎļþËùÔÚµÄĿ¼+"\")  
//»ñÈ¡ºÍÉèÖðüº¬¸ÃÓ¦ÓóÌÐòµÄĿ¼µÄÃû³Æ¡£  
string str = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;  
result: X:\xxx\xxx\ (.exeÎļþËùÔÚµÄĿ¼+"\")  
//»ñÈ¡Æô¶¯ÁËÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÎļþµÄ·¾¶£¬²»°üÀ¨¿ÉÖ´ÐÐÎļþµÄÃû³Æ¡£  
string str = System.Windows.Forms.Application.StartupPath;  
result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼)  
//»ñÈ¡Æô¶¯ÁËÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÎļþµÄ·¾¶£¬°üÀ¨¿ÉÖ´ÐÐÎļþµÄÃû³Æ¡£  
string str = System.Windows.Forms.Application.ExecutablePath;  
result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)  
//»ñÈ¡Ó¦ÓóÌÐòµÄµ±Ç°¹¤×÷Ŀ¼(²»¿É¿¿)¡£  
string str = System.IO.Directory.GetCurrentDirectory();  
result: X:\xxx\xxx (.exeÎļþËùÔÚµÄĿ¼) 
//»ñÈ¡µ±Ç°½ø³ÌµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£
string str = this.GetType().Assembly.Location;
result: X:\xxx\xxx\xxx.exe (.exeÎļþËùÔÚµÄĿ¼+.exeÎļþÃû)
//»ñÈ¡Ð嵀 Process ×é¼þ²¢½«ÆäÓ뵱ǰ»î¶¯µÄ½ø³Ì¹ØÁªµÄÖ÷Ä£¿éµÄÍêÕû·¾¶£¬°üº¬ÎļþÃû(½ø³ÌÃû)¡£
string str = System.Diagnostics.Process.GetCurrentPro


Ïà¹ØÎĵµ£º

C#ÖÐindexOfÓ÷¨

IndexOf()
²éÕÒ×Ö´®ÖÐÖ¸¶¨×Ö·û»ò×Ö´®Ê״γöÏÖµÄλÖÃ,·µÊ×Ë÷ÒýÖµ£¬È磺
str1.IndexOf("×Ö")£» //²éÕÒ“×Ö”ÔÚstr1ÖеÄË÷ÒýÖµ£¨Î»Öã©
str1.IndexOf("×Ö´®")£»//²éÕÒ“×Ö´®”µÄµÚÒ»¸ö×Ö·ûÔÚstr1ÖеÄË÷ÒýÖµ£¨Î»Öã©
str1.IndexOf("×Ö",start,end)£»//´Óstr1µÚstart+1¸ö×Ö·ûÆ𣬲éÕÒend¸ö×Ö·û£¬²éÕ ......

ÈÏʶASP.NETÅäÖÃÎļþWeb.config

Ò»¡¢ÈÏʶWeb.configÎļþ
Web.configÎļþÊÇÒ»¸öXMLÎı¾Îļþ£¬ËüÓÃÀ´´¢´æ ASP.NET Web Ó¦ÓóÌÐòµÄÅäÖÃÐÅÏ¢£¨Èç×î³£ÓõÄÉèÖÃASP.NET Web Ó¦ÓóÌÐòµÄÉí·ÝÑéÖ¤·½Ê½£©£¬Ëü¿ÉÒÔ³öÏÖÔÚÓ¦ÓóÌÐòµÄÿһ¸öĿ¼ÖС£µ±Äãͨ¹ýVB.NETн¨Ò»¸öWebÓ¦ÓóÌÐòºó£¬Ä¬ÈÏÇé¿öÏ»áÔÚ¸ùĿ¼×Ô¶¯´´½¨Ò»¸öĬÈϵÄ
Web.configÎļþ£¬°üÀ¨Ä¬ÈϵÄÅäÖÃÉèÖà ......

ÅäÖÃASP.NETƽ̨ʱÓöµ½µÄ¡°·ÃÎÊIISÔªÊý¾Ý¿âʧ°Ü¡±

Ô­Òò¾ÍÊÇIISºÍ.net Framework2.0°²×°Ë³Ðò·´ÁË£¬ÒòΪÎÒÏÈÇ°Ôø¾­×°¹ýVisualStudio2005£¬ËùÒÔϵͳÀïÏÈ°²×°ÁË.net Framework2.0£¬¶øÕâÑùºóÀ´×°¹ýIISºó£¬.net Frameworkδע²áÏà¹Ø×é¼þ£¬²»ÄܶÔIIS×ö³öÐ޸ģ¬¾Í»á³öÏÖÕâÖÖÇé¿ö£¡
½â¾ö·½·¨£º
µ½C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727ÖÐÕÒ£¬Óиö¹¤¾ß½Ð aspnet_regiis.exe ......

ASP.NET Login¿Ø¼þʹÓ÷½·¨¼°ÐëÖª(ͼ)

ASP.NETµÇ½¿Ø¼þ±È½Ï¶à£¬·â×°Á˴󲿷ÖWEBÓ¦ÓÃÖÐҪʵÏÖϵͳµÇ½µÄϵÁй¦ÄÜ£¬Éæ¼°µ½ºÜ¶à·½Ãæ¡£ÖÚ¶à ASP.NET µÇ¼¿Ø¼þÒ»ÆðΪ ASP.NET Web Ó¦ÓóÌÐòÌṩ¿É¿¿µÄÎÞÐè±à³ÌµÄµÇ¼½â¾ö·½°¸¡£Ä¬ÈÏÇé¿öÏ£¬µÇ¼¿Ø¼þÓë ASP.NET ³ÉÔ±×ʸñºÍ Forms Éí·ÝÑéÖ¤¼¯³É£¬ÒÔ°ïÖúʹÍøÕ¾µÄÓû§Éí·ÝÑéÖ¤¹ý³Ì×Ô¶¯»¯¡£Ä¬ÈÏÇé¿öÏ£¬ASP.NET µÇ¼¿Ø¼þÒÔ´¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ