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

asp.net C#ÍøÕ¾ÏîÄ¿ »ñÈ¡ÎïÀí·¾¶¡¢ÐéÄâ·¾¶µÄ·½·¨

-----------------------------.csÀàÎļþÖÐ
µ±Ç°ÏîÄ¿µÄÎïÀí·¾¶Â  
   
  strPath   =   this.Server.MapPath(Request.PhysicalApplicationPath);  
   
  ÄãҪ˵Ã÷ʲô“ÀàÎļþ”¡£ÈκÎPAGE¡¢CONTROL´úÂëÒ²ÊÇÔÚÀàÖеġ£  
   
  ÉÏÃæµÄthisÖ»Õë¶ÔPage¶ÔÏó£¬Õë¶ÔcontrolÄãÓ¦¸ÃÌæ»»Îªthis.Page¡£ÄãÒ²¿ÉÒÔʹÓ㺠 
   
  strPath   =   HttpContext.Current.Server.MapPath
(HttpContext.Current.Request.PhysicalApplicationPath);  
   
  »òÕߣ¬Ê¹Ó㺠 
   
  strPath   =   AppDomain.CurrentDomain.BaseDirectory;  
--------------------------------´øpageµÄÒ³Ãæ.csÖÐ
ºÜ¾­³£Ê¹Óõ½µÄÒ»¸ö¹¦ÄÜ,µ«ÔÚÔÚÍøÉÏȴһֱûÓÐÕÒµ½Ïà¹ØµÄ½â¾ö·½·¨,½ñÌì½è×ÅÏîĿӦÓõ½µÄ»ú»áдÁËÁ½
¸ö½«¾ø¶Ô·¾¶×ª»»ÎªÐéÄâ·¾¶·â×°ºÃµÄ·½·¨
¡¡¡¡½«WebÕ¾µãϵľø¶Ô·¾¶×ª»»ÎªÏà¶ÔÓÚÖ¸¶¨Ò³ÃæµÄÐéÄâ·¾¶
¡¡¡¡/**//// <summary>
¡¡¡¡/// ½«WebÕ¾µãϵľø¶Ô·¾¶×ª»»ÎªÏà¶ÔÓÚÖ¸¶¨Ò³ÃæµÄÐéÄâ·¾¶
¡¡¡¡/// </summary>
¡¡¡¡/// <param name="page">µ±Ç°Ò³ÃæÖ¸Õ룬һ°ãΪthis</param>
¡¡¡¡/// <param name="specifiedPath">¾ø¶Ô·¾¶</param>
¡¡¡¡/// <returns>ÐéÄâ·¾¶, ÐÍÈç: ../../</returns>
¡¡¡¡public static string ConvertSpecifiedPathToRelativePathForPage(Page page, string
specifiedPath)
¡¡¡¡{
¡¡¡¡ // ¸ùĿ¼ÐéÄâ·¾¶
¡¡¡¡ string virtualPath = page.Request.ApplicationPath;
¡¡¡¡ // ¸ùĿ¼¾ø¶Ô·¾¶
¡¡¡¡ string pathRooted = HostingEnvironment.MapPath(virtualPath);
¡¡¡¡ // Ò³ÃæÐéÄâ·¾¶
¡¡¡¡ string pageVirtualPath = page.Request.Path;
¡¡¡¡ if (!Path.IsPathRooted(specifiedPath) || specifiedPath.IndexOf(pathRooted) == -1)
¡¡¡¡ {
¡¡¡¡ throw new Exception(string.Format("\"{0}\"ÊÇÐéÄâ·¾¶¶ø²»ÊǾø¶Ô·¾¶!", specifiedPath));
¡¡¡¡ }
¡¡¡¡ // ת»»³ÉÏà¶Ô·¾¶
¡¡¡¡ //(²âÊÔ·¢ÏÖ£¬pathRooted ÔÚ VS2005 ×Ô´øµÄ·þÎñÆ÷¸úÔÚIISϸùĿ¼»òÕßÐéÄâĿ¼ÔËÐÐËÆºõ²»Ò


Ïà¹ØÎĵµ£º

asp.netĸ°æÒ³Ê¹Óÿؼþʱ,¿Ø¼þÖз¾¶ÎÊÌâ

¸Õ¸ÕÔÚheadmenu¿Ø¼þÀïÃæÐ´ÁËÒ»¸öµ¼º½Ìõ,Óõ½Á˱¾µØµÄͼƬ,ÔڿؼþÖÐÏÔʾÁ¼ºÃ,¿ÉÊǷŵ½Ä¸°æÊ½Ò³ºó,·¢ÏÖµ¼º½Ìõ±³¾°Í¼Æ¬Ã»ÁË,ÓÚÊÇ×Ðϸ¼ì²éÁËÏÂͼƬµÄurl,ÎÒÓõÄÊǾø¶Ô·¾¶,ÄѵÀ·ÅÔÚÖ÷Ò³ÉϺó,·¾¶Ò²¸Ä±äÁË,ÉÏÍø²éÁËÏÂ,»¹ÕæÊÇÕâ¸öÎÊÌâ,ͼƬÔڿؼþÀïÃæ¿´²»µ½Ã»¹ØÏµ,¹Ø¼üÊÇÒªÔÚĸ°æÊ½Ò³ÄÜ¿´µ½¾ÍÐÐ,·¾¶¶¼Òª¸ù¾Ýĸ°æÒ³µÄд. ......

asp.net »ñÈ¡ÍøÕ¾¸ùĿ¼

»ñÈ¡ÍøÕ¾¸ùĿ¼µÄ·½·¨Óм¸ÖÖÈ磺
Server.MapPath(Request.ServerVariables["PATH_INFO"])
 Server.MapPath("/")
 Server.MapPath("")
Server.MapPath(".")
 Server.MapPath("../")
 Server.MapPath("..")
  &nb ......

C#µ½Java byteÀàÐͳåÍ»µÄ½â¾ö

×î½üÒª¸Äдһ¸öºËÐļÓÃÜÈÏÖ¤À࣬´ÓC#¸Äд³ÉJava¡£
·¢ÏÖÔÚµ÷ÊÔʱ£¬¼ÓÃܵÄÊý¾ÝÎÞÂÛÈçºÎÒ²¶Ô²»ÉÏ¡£
¾­¹ý¸ú×Ù£¬·¢ÏÖÎÊÌâ³öÔÚC#ºÍJava byteÀàÐ͵ÄÇø±ðÉÏ£ºÔÚC#Àï byteÀàÐÍÊÇÎÞ·ûºÅµÄ£¬¶øJavaÀïÊÇÓзûºÅµÄ£¬ËùÒÔC#ÀïµÄ129µ½JavaÀï¾Í³ÉÁ˸ºÊý¡£
·¢ÏÖÁËÎÊÌ⣬½â¾ö¾Í±È½ÏÈÝÒ×ÁË£¬Õë¶ÔJavaµÄbyte£¬²ÉÓÃIntÀ´½øÐд洢¡£
ͨ¹ýÈçÏ´ú ......

ASP.NET×Ô¶¨Òå¿Ø¼þʼþÏìÓ¦

1.ÖØÔØprotected override bool OnBubbleEvent(object source, EventArgs args)
OnBubbleEventÊǿؼþÄÚ°üº¬µÄ¿Ø¼þÏòÍâ²ã¿Ø¼þ×÷ʼþðÅÝ
-------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Co ......

Asp.net AJAX Web Serviceд·¨²îÒì

ÔÚC#ÖÐ
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Ba ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ