ʹÓÃ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µÄÈÎÎñ¾Í½»¸øËûÁË£º
System.Net.CookieContainer cookieContainer = new System.Net.CookieContainer();
MyService.WebService service = new App.MyService.WebService();
service.CookieContainer = cookieContainer;
2.ÎÒÃDz»ÏëʹÓÃWeb±íµ¥½øÐÐÉí·ÝÑéÖ¤£¬ÐÒÔ˵ÄÊÇ£¬ASP.Net±íµ¥ÑéÖ¤ÖÐµÄ±íµ¥Ò³£¨¼´Web.configÎļþÖÐ forms ÔªËØÄÚµÄloginUrl£©Í¬Ñù¿ÉÒÔÖ¸¶¨ÎªWebServiceÎļþ¡£
ÎÒÃÇ´´½¨Ò»¸öרÃÅÓÃ×÷Éí·ÝÑéÖ¤µÄWeb·þÎñ£¬ÔÝÇÒÃüÃûΪLogin.asmx£¬È»ºóÈà loginUrl µÈÓÚ “Login.asmx”£¬µ±È»£¬»¹ÐèÒªÔÚWeb.configÎļþÖÐµÄ authorization ½ÚÖнûÖ¹ÄäÃû·ÃÎÊ£¨·ñÔòÎÒÃǿɾͰ×æ»îÁË£©£¬Íê³ÉÅäÖúóµÄWeb.configÎļþÈçÏ£º
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="false" />
<authentication mode="Forms">
<forms na
Ïà¹ØÎĵµ£º
private
static
CacheItemRemovedCallback OnCacheRemove
=
null
;
protected
void
Application_Start(
object
sender, EventArgs e)
{
AddTask(
"
DoStuff
"
,
60
);
}
private
vo ......
ʹÓà ConfigurationSettings ¶ÔÏóµÄ AppSettings ÊôÐÔ¼ìË÷ ASP.NET ÅäÖÃÐÅÏ¢¡£
ASP.NET ÔÊÐí¿ª·¢ÈËԱͨ¹ýÖ±½Ó¹«¿ªÅäÖÃÉèÖã¨ÒÔÇ¿ÀàÐÍÊôÐÔµÄÐÎʽ£©»òʹÓó£¹æÅäÖà API£¬´ÓÓ¦ÓóÌÐòÖзÃÎÊÅäÖÃÉèÖá£Ï ......
C#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃ
ÎÊ£º
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
ÎÊÌâ1´ð°¸ÈçÏ£º
javaScriptº¯ÊýÖÐÖ´ÐÐC#´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ ......
Page Ö´ÐÐÖн«°´ÕÕÈçÏÂ˳Ðò¼¤»îʼþ£º
Page.PreInit
Page.Init
Page.InitComplite
Page.PreLoad
Page.Load
Page.LoadComplete
Page.PreRender
Page.PreRenderComplete
Èç¹ûÒ³Ãæ´ÓÁîÒ»¸öÒ³Ãæ¼Ì³Ð£¬ÈçBasePage:System.Web.UI.Page£¬ÔÚBasePageÖÐ×öÁËһЩÀ©Õ¹£¬ÈçȨÏÞ¼ì²é£¬¶øÆäËûÒ³Ãæ´ÓBasePage¼Ì³Ð£¬ÔòBasePageºÍ×î ......
ASP.NETÊÇÒ»¸ö·Ç³£Ç¿´óµÄ¹¹½¨WebÓ¦ÓõÄƽ̨£¬ËüÌṩÁ˼«´óµÄÁé»îÐÔºÍÄÜÁ¦ÒÔÖÂÓÚ¿ÉÒÔÓÃËüÀ´¹¹½¨ËùÓÐÀàÐ͵ÄWebÓ¦Óá£
¾ø´ó¶àÊýµÄÈËÖ»ÊìϤ¸ß²ãµÄ¿ò¼ÜÈ磺 WebForms ºÍ WebServices --ÕâЩ¶¼ÔÚASP.NET²ã´Î½á¹¹ÔÚ×î¸ß²ã¡£
ÕâƪÎÄÕµÄ×ÊÁÏÊÕ¼¯ÕûÀí×Ô¸÷ÖÖ΢Èí¹«¿ªµÄÎĵµ£¬Í¨¹ý±È½Ï IIS5¡¢IIS6¡¢IIS7 ÕâÈý´ú IIS ¶ÔÇëÇóµÄ´¦Àí¹ý³ ......