ÉèÖÃ×Ô¶¨ÒåASP.NET·þÎñÆ÷¿Ø¼þTagPrefixµÄ¼¸ÖÖ·½·¨
·½·¨Ò»¡¢ÔÚWeb.configÖÐÅäÖÃ,¾ßÌå×ö·¨Îª:ÔÚWeb.configÎļþµÄSystem.web½ÚÖÐÌí¼ÓÈçÏ´úÂë
1<pages>
2 <controls>
3 <add assembly="ServerControl" namespace="ServerControl" tagPrefix="sc"/>
4 </controls>
5</pages>
˵Ã÷£ºassembly±íʾ¿Ø¼þËùÔڵijÌÐò¼¯Ãû³Æ£¬namespace±íʾ¿Ø¼þµÄÃüÃû¿Õ¼ä£¬tagPrefix¾ÍÊÇÎÒÃÇËùÒªÉèÖõÄÏîÁË
·½·¨¶þ¡¢ÔÚʹÓøÿؼþµÄÒ³ÃæÌí¼Ó<%Register%>Ö¸ÁÈçÏÂ
<%@ Register assembly="ServerControl" namespace="ServerControl" tagprefix="sc" %>
˵Ã÷£ºassembly±íʾ¿Ø¼þËùÔڵijÌÐò¼¯Ãû³Æ£¬namespace±íʾ¿Ø¼þµÄÃüÃû¿Õ¼ä£¬tagPrefix¾ÍÊÇÎÒÃÇËùÒªÉèÖõÄÏîÁË
·½·¨Èý¡¢Í¨¹ý×°ÊÎAttributeÀ´Ö¸¶¨tagPrefix£¬ÀýÈçÔڿؼþÀàÌí¼ÓÈçÏÂAttribute
[assembly: TagPrefix("ServerControl", "scsc")]
namespace ServerControl
{
[ToolboxData("<{0}:EmailInput runat=server></{0}:EmailInput>")]
public class EmailInput : CompositeControl
{
˵Ã÷£º¼´Ê¹ÕâÑù¶¨ÒåÁË£¬Ã¿¸öÒ³ÃæÒ²¶¼ÒªÌí¼Ó<%Register%>Ö¸ÁÕâÑùÖ»ÊÇÌṩÁËͳһµÄtagPrefix£¬ÊµÖÊÉÏ»¹ÊǵڶþÖÖ·½·¨
·½·¨ËÄ¡¢ÔڿؼþÏîÄ¿ÖÐÌí¼ÓÊôÐÔÎļþ"Assembly.cs"ÖÐÌí¼ÓÈçÏ´úÂëÀ´×Ô¶¨Òå¿Ø¼þµÄǰ׺£º
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Web.UI;
[assembly: TagPrefix("ServerControl","scsc")]
˵Ã÷£º¼´Ê¹ÕâÑù¶¨ÒåÁË£¬Ã¿¸öÒ³ÃæÒ²¶¼ÒªÌí¼Ó<%Register%>Ö¸Áî,ÕâÑùÖ»ÊÇÌṩÁËͳһµÄtagPrefix£¬ÊµÖÊÉÏ»¹ÊǵڶþÖÖ·½·¨
×îºó¶ÔÉÏÃæµÄËÄÖÖ·½·¨½øÐÐ˵Ã÷£º
ÔÚWeb.configÖнøÐÐ×Ô¶¨ÒåÊÇÊôÓÚÓ¦ÓóÌÐò¼¶±ðµÄ¶¨Ò壬ֻע²áÒ»´Î¼´¿É¶ÔÕû¸öÓ¦ÓóÌÐòÓÐЧ¡£ÆäËûÈýÖÖ·½·¨¶¼µÃÔÚÒýÓøÿؼþµÄÒ³ÃæÌí¼Ó<%Register%>Ö¸Áî
asp.net¶¨ÒåtagPrefixµÄ¼ì²â˳ÐòÊÇ£ºassemblyInfo.cs---->¿Ø¼þÖеÄattribute×°ÊÎ----->webconfigÖеÄÅäÖã¬Ò²¾ÍÊÇ˵£¬Èç¹ûÕ⼸ÖÖ·½·¨Äú¶¼ÉèÖÃÁË£¬ÄÇôasp.net ½«»á²ÉÓÃwebconfigµÄÉèÖ÷½Ê½£¡ÏàÐÅÕâÒ²ÊÇasp.net¸²¸ÇµÄ¼òµ¥µÀÀíÁË£¡
asp.netµÄ×Ô´ø¿Ø¼þ²ÉÓÃÁ˵ÚÒ»ÖÖ·½·¨£¬¼´ÔÚ web.configÖнøÐÐÁËÅäÖ㬽«tagPrefixÅäÖóÉÁËasp£¬Èç¹ûÄú¿´×Ų»Ë¬£¬¿ÉÒԸĵôËü¡£
Ïà¹ØÎĵµ£º
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e )
{ ......
×î½ü£¬Òª°ÑÒ»¸öC/S½á¹¹µÄ³ÌÐò¸Ä³ÉB/S½á¹¹¡£ÆäÖоÍÓöµ½ÁË´òÓ¡µÄÎÊÌâ¡£Ñо¿ÁËһϣ¬webÏ´òÓ¡·½·¨´ó¸ÅÓÐÕâô¼¸ÖÖ£º
1¡¢ÀûÓÃIEÖ±½Ó´òÓ¡£¬ÕâÖÖ·½Ê½×î·½±ã£¬µ«ÊÇ¿ØÖÆÄÜÁ¦½Ï²î¡£
2¡¢ÀûÓÃACTIVE¿Ø¼þ£¬¿ÉÒÔ×Ô¼º×öÒ»¸öIEµÄ¿Ø¼þÀ´¿ØÖÆ´òÓ¡¡£
3¡¢Ë®¾§±¨±íµÈµÚÈý·½¹¤¾ß£¬¹ºÂò¼Û¸ñ°º¹ó¡£
¸ù¾ÝÎÒµÄÐèÇóÇé¿ö£¬ÓÃIEÖ ......
Ò»¡¢Èý²ãÌåϵ¼Ü¹¹¡¡¡¡1.±íʾ²ã(USL)£ºÖ÷Òª±íʾWEB·½Ê½£¬Ò²¿ÉÒÔ±íʾ³ÉWINFORM·½Ê½¡£Èç¹ûÂß¼²ãÏ൱ǿ´óºÍÍêÉÆ£¬ÎÞÂÛ±íÏÖ²ãÈçºÎ¶¨ÒåºÍ¸ü¸Ä£¬Âß¼²ã¶¼ÄÜÍêÉƵØÌṩ·þÎñ¡£
¡¡¡¡2.ÒµÎñÂß¼²ã(BLL)£ºÖ÷ÒªÊÇÕë¶Ô¾ßÌåµÄÎÊÌâµÄ²Ù×÷£¬Ò²¿ÉÒÔÀí½â³É¶ÔÊý¾Ý²ãµÄ²Ù×÷£¬¶ÔÊý¾ÝÒµÎñÂß¼´¦Àí¡£Èç¹û˵Êý¾Ý²ãÊÇ»ýľ£¬ÄÇÂß¼²ã¾ÍÊǶÔÕâЩ»ýľµÄ ......
Ôõôдһ¶Îasp.net´úÂ룬°ÑÒ»¸ö×Ö·û´®ÖÐËùÓеÄHTML±ê¼Ç¶¼È¥µô£¬Ö»Ê£ÏÂÎÄ×ÖÄÚÈÝÄØ£¿
±ÈÈ磺<td width=\"427\" align=\"left\" class=\"cn\">½Ï¸ßµÄζȣ¬¿ÉÄÜÔö¼ÓÆ¡¾Æ¶ÔÄúµÄÓÕ»ó£¬ÊÊÁ¿ÒûÓÃÆ¡¾Æ»á¸øÄú´øÀ´ÇåÁ¹µÄ¸Ð¾õ£¬µ«Ç§Íò×¢Òâ²»Òª¹ýÁ¿ßÏ£¡</td>
......
ASP.NETÉú³É¾²Ì¬Ò³
ºËÐļ¼Êõ£º
HTMLPageÎļþ¼Ð£¬ModelHTML.htmÎļþÖеÄArticleTitle,ArticleContent¶¼ÊÇÒªÌæ»»µÄÇøÓò
WriteFile(dr["ArticleTitle"].ToString(), dr["ArticleContent"].ToString(), dr["ID"].ToString());
1.ǰ̨
<head runat="server">
<title>ASP.NETÉú³É¾²Ì¬ÍøÒ³</title>
& ......