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ϸùĿ¼»òÕßÐéÄâĿ¼ÔËÐÐËÆºõ²»Ò
Ïà¹ØÎĵµ£º
¸Õ¸ÕÔÚheadmenu¿Ø¼þÀïÃæÐ´ÁËÒ»¸öµ¼º½Ìõ,Óõ½Á˱¾µØµÄͼƬ,ÔڿؼþÖÐÏÔʾÁ¼ºÃ,¿ÉÊǷŵ½Ä¸°æÊ½Ò³ºó,·¢ÏÖµ¼º½Ìõ±³¾°Í¼Æ¬Ã»ÁË,ÓÚÊÇ×Ðϸ¼ì²éÁËÏÂͼƬµÄurl,ÎÒÓõÄÊǾø¶Ô·¾¶,ÄѵÀ·ÅÔÚÖ÷Ò³ÉϺó,·¾¶Ò²¸Ä±äÁË,ÉÏÍø²éÁËÏÂ,»¹ÕæÊÇÕâ¸öÎÊÌâ,ͼƬÔڿؼþÀïÃæ¿´²»µ½Ã»¹ØÏµ,¹Ø¼üÊÇÒªÔÚĸ°æÊ½Ò³ÄÜ¿´µ½¾ÍÐÐ,·¾¶¶¼Òª¸ù¾Ýĸ°æÒ³µÄд. ......
»ñÈ¡ÍøÕ¾¸ùĿ¼µÄ·½·¨Óм¸ÖÖÈ磺
Server.MapPath(Request.ServerVariables["PATH_INFO"])
Server.MapPath("/")
Server.MapPath("")
Server.MapPath(".")
Server.MapPath("../")
Server.MapPath("..")
&nb ......
×î½üÒª¸Äдһ¸öºËÐļÓÃÜÈÏÖ¤À࣬´ÓC#¸Äд³ÉJava¡£
·¢ÏÖÔÚµ÷ÊÔʱ£¬¼ÓÃܵÄÊý¾ÝÎÞÂÛÈçºÎÒ²¶Ô²»ÉÏ¡£
¾¹ý¸ú×Ù£¬·¢ÏÖÎÊÌâ³öÔÚC#ºÍJava byteÀàÐ͵ÄÇø±ðÉÏ£ºÔÚC#Àï byteÀàÐÍÊÇÎÞ·ûºÅµÄ£¬¶øJavaÀïÊÇÓзûºÅµÄ£¬ËùÒÔC#ÀïµÄ129µ½JavaÀï¾Í³ÉÁ˸ºÊý¡£
·¢ÏÖÁËÎÊÌ⣬½â¾ö¾Í±È½ÏÈÝÒ×ÁË£¬Õë¶ÔJavaµÄbyte£¬²ÉÓÃIntÀ´½øÐд洢¡£
ͨ¹ýÈçÏ´ú ......
1.ÖØÔØprotected override bool OnBubbleEvent(object source, EventArgs args)
OnBubbleEventÊǿؼþÄÚ°üº¬µÄ¿Ø¼þÏòÍâ²ã¿Ø¼þ×÷ʼþðÅÝ
-------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Co ......
ÔÚ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 ......