asp.net¿Í»§¶Ë½Å±¾µ÷ÓÃÒ³Ãæ·½·¨
µÚÒ»²½£º
½«Ä³¸öÒ³ÃæµÄ·½·¨ ÓÐ webmethod attribute;
[WebMethod]
//Ö»ÄÜÊÇ public static µÄ·½·¨
public static DateTime GetCurrentTime()
{
return DateTime.UtcNow;
}
µÚ¶þ²½£º
Ò³ÃæÓÐÒ»¸öScriptManager ÉèÖÃËüµÄenablepagemethod=true;
asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
µÚÈý²½£ºµ÷ÓÃ
PageMethods.·½·¨Ãû£¨»Øµ÷º¯Êý£©
<mce:script language="javascript" type="text/javascript"><!--
function getCurrentTime()
{
PageMethods.GetCurrentTime(getCurrentTimeSucceeded);
}
function getCurrentTimeSucceeded(result)
{
alert(result);
}
// --></mce:script>
Ïà¹ØÎĵµ£º
ÔÚWeb±à³Ì¹ý³ÌÖУ¬´æÔÚןܶలȫÒþ»¼¡£±ÈÈçÔÚÒÔÇ°µÄASP°æ±¾ÖУ¬CookieΪ·ÃÎÊÕߺͱà³ÌÕ߶¼ÌṩÁË·½±ã£¬²¢Ã»ÓÐÌṩ¼ÓÃܵŦÄÜ¡£´ò¿ªIEä¯ÀÀÆ÷£¬Ñ¡Ôñ“¹¤¾ß”²Ëµ¥ÀïµÄ“InternetÑ¡Ï¬È»ºóÔÚµ¯³öµÄ¶Ô»°¿òÀïµ¥»÷“ÉèÖÔ°´Å¥£¬Ñ¡Ôñ“²é¿´Îļþ”°´Å¥£¬ÔÚµ¯³öµÄ´°¿ÚÖУ¬¾Í»áÏÔʾӲÅÌÀï ......
Ч¹ûͼ£º
ǰ̨´úÂ룺
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OWCdrawing.aspx.cs" Inherits="OWCdrawing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xh ......
´Ë´¦ÌṩµÄ´úÂëÓÃÀ´ÊµÏÖµ±asp.netÒ³ÃæÖеÄij¸öButton±»µã»÷ºódisableµô¸ÃÒ³ÃæÖÐËùÓеÄButton£¬´Ó¶ø·ÀÖ¹Ìá½»ÑÓʱµ¼ÖµĶà´ÎÌá½»¡£»ùÓÚ֮ǰµÄonceclickbutton½Å±¾.
//ASP.NETÖзÀÖ¹Ò³Ãæ¶à´ÎÌá½»µÄ´úÂë:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.s ......
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔÀ´ÊäÈëµÄÊý¾Ý½øÐÐÐ޸ĻòÕ߸üÐÂʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼ÓµÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.NETÖж¼ÊÇÓÃÒ»¸öButton¿Ø¼þÀ´ÊµÏֵģ¬ÊµÏֵķ½·¨Óкܶ࣬½ñÌìÇ¡ºÃÔÚ×öÏîĿʱÅöµ½ÒªÓÃÕâ¸ö¶«¶«£¬ÎҾͰÑÄÜʵÏÖ" ·µ» ......
ĬÈÏÇé¿öÏ£¬ÄäÃûÓû§²»ÄÜÐÞ¸ÄprofileÊôÐÔ£¬ÎÊÌâÔÚÓÚASP.NET FrameworûÓа취¹ØÁªProfileÊý¾ÝºÍÌض¨µÄÓû§£¬³ý·ÇÓû§ÊǾ¹ýÉí·ÝÑéÖ¤µÄ¡£
Èç¹ûÏ£ÍûÄäÃûÓû§ÐÞ¸ÄprofileµÄÊôÐÔ£¬±ØÐëÆôÓÃASP.NET FrameworkµÄÄäÃûÈÏÖ¤£¨Anonymous Identification£©µÄ¹¦ÄÜ¡£µ±¿ªÆôÕâ¸ö¹¦ÄÜʱ£¬Ò»¸ö±êʶ£¨Ò»¸öGUID£©±»·ÖÅä¸øÄäÃûÓû§£¬²¢ ......