Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : asp.net

ʹÓÃASP.Net FormsģʽʵÏÖWebServiceÉí·ÝÑéÖ¤

ʹÓÃASP.Net FormsģʽʵÏÖWebServiceÉí·ÝÑéÖ¤
    ÔÚ°²È«ÐÔÒªÇó²»ÊǺܸߵÄASP.Net³ÌÐòÖУ¬»ùÓÚFormsµÄÉí·ÝÑéÖ¤ÊǾ­³£Ê¹ÓõÄÒ»ÖÖ·½Ê½£¬¶øÈç¹ûÐèÒª¶ÔWebService½øÐÐÉí·ÝÑéÖ¤£¬×î³£ÓõĿÉÄÜÊÇ»ùÓÚSoap ±êÍ·µÄ×Ô¶¨ÒåÉí·ÝÑéÖ¤·½Ê½¡£Èç¹û¶ÔÁ½Õß×öһϱȽϵĻ°£¬ÏÔÈ»£¬»ùÓÚFormsµÄÑéÖ¤·½Ê½¸ü¼Ó·½±ãÒ×Óã¬ÄÜ·ñ½«FormsÑéÖ¤·½Ê½Ó¦Óõ½WebServiceÖÐÈ¥ÄØ£¿ 
    ´ÓÀíÂÛÉϽ²£¬Ê¹ÓûùÓÚFormsµÄ·½Ê½¶ÔWebService½øÐÐÉí·ÝÑéÖ¤ÊÇ¿ÉÐеģ¬µ«ÊÇʹÓùý³ÌÖлá´æÔÚÒÔÏÂÁ½¸öÎÊÌ⣺
1.»ùÓÚFormsµÄÑéÖ¤·½Ê½Í¬Ê±Ò²ÊÇ»ùÓÚCookieµÄÑéÖ¤·½Ê½£¬ÔÚʹÓÃä¯ÀÀÆ÷ʱ£¬Õâ¸öÎÊÌâÊDz»ÐèÒªÎÒÃÇ¿¼Âǵġ£µ«¶ÔÓÚʹÓÃWebServiceµÄÓ¦ÓóÌÐòÀ´Ëµ£¬Ä¬ÈÏÊDz»Äܱ£´æCookieµÄ£¬ÐèÒªÎÒÃÇ×Ô¼ºÈ¥×öÕâ¸ö¹¤×÷¡£
2.WebService¼ÈÈ»ÊÇÒ»¸öA2A(Application To Application)Ó¦ÓóÌÐò£¬Ê¹ÓÃWeb±íµ¥½øÐÐÉí·ÝÑéÖ¤ÏÔÈ»²»Ì«ºÏÊÊ£¬¶øÇÒ£¬Õ⽫²»¿É±ÜÃâµÄÔì³ÉÈË»ú½»»¥£¬Ê¹WebServiceµÄÓ¦Óôó´òÕÛ¿Û¡£
  ½ÓÏÂÀ´£¬ÎÒÃǾͷֲ½½â¾öÕâÁ½¸öÎÊÌ⣺
1.CookieµÄ±£´æÎÊÌâ
    WebServiceµÄ¿Í»§¶Ë´úÀíÀàÓÐÒ»¸öÊôÐÔCookieContainer¿ÉÓÃÓÚÉèÖûò»ñÈ¡Cookie¼¯ºÏ£¬±£´æCookieµÄÈÎÎñ¾Í½»¸øËûÁ ......

ASP.NETÖеÄHttpWorkerRequest¶ÔÏñ¼°ÆäÓ¦ÓÃ

HttpWorkerRequest¶ÔÏñÔÚASP.Net´¦ÀíÁ÷³ÌÖеÄλÖãº
ÿһ¸öASP.NET³ÌÐòÖ´ÐÐʱ¶¼»á¶Ôµ±Ç°URLµÄÇëÇó½øÐнâÎö£¬±¾ÎĽ«·ÖÎöASP.NETÒ³ÃæÇëÇóµÄÔ­Àí¡£µ±ÎÒÃÇÔÚä¯ÀÀÆ÷ÉÏÊäÈëÒ»¸öURLʱ£¬ Á÷³ÌÈçÏ£º
Ê×Ïȱ»WWW·þÎñÆ÷½Ø»ñ£¨inetinfo.exe½ø³Ì£©£¬ ¸Ã½ø³ÌÊ×ÏÈÅжÏÒ³Ãæºó׺£¬ È»ºó¸ù¾ÝIISÖÐÅäÖþö¶¨µ÷ÓþßÌåµÄÀ©Õ¹³ÌÐò¡£
Èçaspx¾Í»áµ÷ÓÃaspnet_isapi.dll, È»ºóÓÉaspnet_isapi.dll·¢Ë͸øw3wp.exe£¨iis ¹¤×÷Õß½ø³Ì£¬IIS6.0ÖнÐ×ö w3wq.exe£¬IIS5.0ÖнÐ×ö aspnet_wp.exe).
½ÓÏÂÀ´¾ÍÊÇw3wp.exeµ÷ÓÃ.netÀà¿â½øÐоßÌå´¦Àí£¬Á÷³ÌÈçÏ£º
ISAPIRuntime-->HttpRuntime-->HttpApplicationFactory-->HttpApplication-->HttpModule--HttpHandlerFactory-->HttpHandle
1. ISAPIRuntime
Ö÷Òª×÷ÓÃÊǵ÷ÓÃһЩ·ÇÍйܴúÂëÉú³ÉHttpWorkerRequest¶ÔÏó£¬HttpWorkerRequest¶ÔÏó°üº¬µ±Ç°ÇëÇóµÄËùÓÐÐÅÏ¢£¬È»ºó´«µÝ¸øHttpRuntime£¬ÕâÀïÉú³ÉµÄHttpWorkerRequest¶ÔÏó¿ÉÒÔÖ±½ÓÔÚÎÒÃǵÄÒ³ÃæÖе÷Óõģ¬Í¨¹ýËüÈ¡µÃԭʼµÄÇëÇóÐÅÏ¢£º
2. HttpRuntime
a. ¸ù¾ÝHttpWorkerRequest¶ÔÏóÉú³ÉHttpContext£¬HttpContext°üº¬request¡¢responseµÈÊôÐÔ£»
b. µ÷ÓÃHttpApplicationFactoryÀ´Éú³ÉIHttpHandler(ÕâÀï ......

ASP.NETÖеÄͼƬÉÏ´«

protected void Button3_Click(object sender, EventArgs e)
    {
        //¶¨Òå±äÁ¿,ÅжÏÊÇ·ñÓÐͼƬÉÏ´«
        bool fileIsValid = false;
        //Èç¹ûÓÐͼƬÉÏ´«,ÅжÏÆä¸ñʽ
        if (this.FileUpload1.HasFile)
        {
            int len = this.FileUpload1.PostedFile.ContentLength;
            if (len / 1024 > 60)
            {
                this.Label1.Text = "ͼƬ̫´óÁË";
                return;
            }
  ......

Asp.netÒ³ÃæÖÐÒýÓÃjsÎļþÎÞЧµÄÎÊÌâµÄ½â¾ö·½·¨

ÔÚBSÏîÄ¿ÖУ¬Ä³¸öaspxÒ³ÃæÐèÒªÒýÓÃÍⲿ½Å±¾Îļþ£¬Í¨¹ýÔÚÒ³Ãæhead½Ú<script language="" src="">·½Ê½ÒýÓÃÖ¸¶¨µÄjsÖ®ºó£¬ÈÔÈ»ÎÞЧ¡£Í¨¹ýalert·½Ê½µ÷ÊÔ£¬·¢ÏÖÊÇÓÉÓÚjsÎļþ±àÂëÓëjsÎļþÄÚÈݲ»·û¡£ÓÉÓÚjsÎļþÖаüº¬ÖÐÎÄ×¢ÊÍ£¬ËùÒÔÐèÒªÉèÖÃjsÎļþΪ¿Éʶ±ðÖÐÎĵÄgb2312±àÂë¡£Æä·½·¨ÔÚÍøÉÏÒ²½²Êö£¬ÒÔÏÂΪÍøÕªÄÚÈÝ£º
         ÔÚ.netÖÐͨ¹ýÕâÖÖ·½Ê½ÒýÓÃjsÎļþ
<script type="text/javascript" src="setday0.js"></script>
È»ºóÔÚÒ³ÃæÖе÷ÓÃsetday0.jsÎļþÖеķ½·¨ÍùÍù»á³ö´í£¡µ«ÊÇÄãÈç¹û°Ñsetday0.jsÎļþµÄÄÚÈÝÖ±½Ó·Åµ½¸ÃÒ³ÃæÖÐÀ´ÓÖÒ»µãÎÊÌâҲûÓС£Õâ¸öÎÊÌâÀ§»óÁËÎҺܾã¬ÔÚ1.1µÄʱºò¾ÍÓöµ½Á˵±Ê±Ã»°ì·¨¾ÍÔÚÒ³ÃæÖÐÖØдjs´úÂë¡£½ñÌì²Å·¢ÏÖÁËÕâ¸öÎÊÌâµÄ½â¾ö°ì·¨¡£
   Õâ¸öÎÊÌâÊÇÓÉÓÚ.netÖеÄtext±àÂëËùÒýÆðµÄ£¬ÎÒÃÇÐèÒª°Ñsetday0.jsÎļþ±£´æΪUTF-8»òÕßÆäËûUnicode±àÂ뷽ʽ£¬ÎÊÌâ¾ÍÓ­Èжø½â¡£Ô­À´µÄÎı¾±àÂëΪgb2312£¬ÒòΪÆäÖÐÓкº×Ö¡£
  ÈçºÎ½øÐбàÂëת»»£¿
  1¡¢ÓüÇʱ¾´ò¿ª£¬±£´æµÄʱºòÑ¡ÔñUnicode±àÂ룻
  2¡¢Ö±½ÓÔÚvsÖÐÑ¡ÔñÁí´æΪ£¬±£´æ°´Å¥ÓÒ±ßÓиöС¼ýÍ·£¬µãһϣ¬È»ºóÑ¡Ôñ±àÂë·½Ê ......

asp.netµ÷ÓÃjs½Å±¾·½·¨

1¡¢Ö±½ÓÔÚǰ̨µ÷Óà javascript º¯Êý 
ºÜ¼òµ¥,ÔÚ head ÔªËØÖ®¼ä¼ÓÈë script ÔªËØ,½« type ÔªËØÉèÖÃΪ " text/javascript " 
Èç:
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
<head runat="server"> 
<script type="text/javascript" > 
function ShowName(str) 

alert("ÄúµÄÃû×ÖΪ:("+str+")"); 

</script> 
<title>using javascript</title> 
</head>
Ö®ºóÔÚbody ÔªËؼä,ͨ¹ýʼþÀ´·ÃÎÊ Èç Ҫͨ¹ýbutton1 µÄµ¥»÷ʼþ(onclientclick)À´·ÃÎÊ javascript º¯Êý 
ʾÀýÈçÏÂ:
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
<asp:Button ID="Button1" runat="server" Text="Button" onclientclick="ShowName('XXX')" />
ÕâʱÔËÐÐÏîÄ¿,µ¥»÷ buttonʱ,»áÏÔʾ"ÄúµÄÃû³ÆΪXXX" 
Õâ¾ÍÊÇÒ»¸ö¼òµ¥µÄjavascript º¯Êý. 
2¡¢ÔÚǰ̨ͨ¹ý jsÎļþ µ÷Óà
·½·¨Óë £¨1£©Ò»Ñù Ö»²»¹ýÐèÒªÖ¸¶¨ .js Îļþ 
ʾÀýÈçÏÂ:
¸´ÖÆ´úÂë ´úÂëÈçÏÂ:
<head runat="server"> 
<script type="text/javascript" src="JScript.js"> 
</script> 
<title>u ......

ASP.NETÒ³Ãæ´«Êý¾ÝµÄ¸÷ÖÖ·½·¨ºÍ·ÖÎö

WebÒ³ÃæÊÇÎÞ״̬µÄ£¬ ·þÎñÆ÷¶Ôÿһ´ÎÇëÇó¶¼ÈÏΪÀ´×Ô²»Í¬Óû§£¬Òò´Ë£¬±äÁ¿µÄ״̬ÔÚÁ¬Ðø¶ÔͬһҳÃæµÄ¶à´ÎÇëÇóÖ®¼ä»òÔÚÒ³ÃæÌøתʱ²»»á±»±£Áô¡£ÔÚÓÃASP.NET Éè¼Æ¿ª·¢Ò»¸öWebϵͳʱ£¬ Óöµ½Ò»¸öÖØÒªµÄÎÊÌâÊÇÈçºÎ±£Ö¤Êý¾ÝÔÚÒ³Ãæ¼ä½øÐÐÕýÈ·¡¢°²È«ºÍ¸ßЧµØ´«ËÍ£¬Asp.net ÌṩÁË״̬¹ÜÀíµÈ¶àÖÖ¼¼ÊõÀ´½â¾ö±£´æºÍ´«µÝÊý¾ÝÎÊÌ⣬ÒÔÏÂÀ´Ì½ÌÖ.NET ϵĽâ¾ö´ËÎÊÌâµÄ¸÷ÖÖ·½·¨ºÍ¸÷×ÔµÄÊÊÓó¡ºÏ¡£
1.1 ʹÓÃQuerystring ·½·¨ 
QueryString Ò²½Ð²éѯ×Ö·û´®£¬ ÕâÖÖ·½·¨½«Òª´«µÝµÄÊý¾Ý¸½¼ÓÔÚÍøÒ³µØÖ·(URL)ºóÃæ½øÐд«µÝ¡£ÈçÒ³ÃæA.aspx Ìøתµ½Ò³ÃæB.aspx£¬¿ÉÒÔÓÃRequest.Redirect("B.aspx?²ÎÊýÃû³Æ=²ÎÊýÖµ")·½·¨£¬Ò²¿ÉÒÔÓó¬Á´½Ó£º£¬Ò³ÃæÌøתºó£¬ÔÚÄ¿±êÒ³ÃæÖпÉÓÃRuquest["²ÎÊýÃû³Æ"]À´½ÓÊÕ²ÎÊý¡£Ê¹ÓÃQuerySting ·½·¨µÄÓŵãÊÇʵÏÖ¼òµ¥£¬ ²»Ê¹Ó÷þÎñÆ÷×ÊÔ´£»È±µãÊÇ´«µÝµÄÖµ»áÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÉÏ£¬Óб»´Û¸ÄµÄ·çÏÕ£¬²»ÄÜ´«µÝ¶ÔÏó£¬Ö»ÓÐÔÚͨ¹ýURL ÇëÇóҳʱ²éѯ×Ö·û´®²ÅÊÇ¿ÉÐеġ£
1.2 ÀûÓÃÒþ²ØÓò 
Òþ²ØÓò²»»áÏÔʾÔÚÓû§µÄä¯ÀÀÆ÷ÖУ¬ Ò»°ãÊÇÔÚÒ³ÃæÖмÓÈëÒ»¸öÒþ²Ø¿Ø¼þ£¬ Óë·þÎñÆ÷½øÐн»»¥Ê±°ÑÖµ¸³¸øÒþ²Ø¿Ø¼þ²¢Ìá½»¸øÏÂÒ»Ò³Ãæ¡£Òþ²ØÓò¿ÉÒÔÊÇÈκδ洢ÔÚÍøÒ³ÖеÄÓëÍøÒ³ÓйصÄÐÅÏ¢µÄ´æ´¢¿â¡ ......
×ܼǼÊý:2672; ×ÜÒ³Êý:446; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [4] [5] [6] [7] 8 [9] [10] [11] [12] [13]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ