Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.netÉú³É¾²Ì¬Ò³(Ö®¶þ)

ÏȽ¨¸öhtmlÄ£°æÒ³(template.htm)£º
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 
<title>$title</title>
 
</head>
 
<body>
<table $htmlformat[0] height="100%" border="0" width="100%" cellpadding="10" cellspacing="0" bgcolor="#eeeeee" style="border:1px solid #000000">
<tr>
<td width="100%" valign="middle" align="left">
<span style="color: $htmlformat[1];font-size: $htmlformat[2]">$htmlformat[3]</span>
</td>
</tr>
</table>
</body>
</html>
ÔÙн¨Ò»¸öaspxµÄÎļþ,Ìí¼Ó´úÂëÈçÏÂ:
string[] format=new string[4];//¶¨ÒåºÍhtmlyem±ê¼ÇÊýÄ¿Ò»ÖµÄÊý×é
           StringBuilder htmltext=new StringBuilder();
           try
           {
            using (StreamReader sr= new StreamReader(base.Server.MapPath(".")+"\\template.htm"))
¡¡            {
¡¡¡¡            String line;
¡¡¡¡            while ((line = sr.ReadLine()) != null)
¡¡¡¡            {
¡¡¡¡¡¡             htmltext.Append(line);
¡¡¡¡            }
¡¡¡¡            sr.Close();
¡¡            }
           }
     


Ïà¹ØÎĵµ£º

asp.netÑéÖ¤¿Ø¼þ²»Æð×÷ÓõĽâ¾ö°ì·¨

×î½üд³ÌÐòÒ»Ö±³öÎÊÌ⣬ÒÔÇ°Ò»¸öÕ¾Èý¼¸Ìì¾ÍÇáËɸ㶨£¬ÏÖÔÚÒ»¸öÄ£¿é¾­³£¸ã°ëÌ죬NND
ÏÂÎ翪·¢¿áÒ×»¯×±Æ·É̳Ç(http://www.koyee.net)Ò»¸ö±íµ¥Ìá½»¹¦ÄÜÄ£¿é£¬±¾µØÈκÎÎÊÌⶼûÓÐÁË£¬´«µ½·þÎñÆ÷Éϱ¾ÒÔΪûÊÂÁË£¬ºóÀ´Ò»¼ì²éËùÓеÄÑéÖ¤¿Ø¼þ¶¼²»Æð×÷ÓÃÁË£¬Ö±½Ó¶¼Ìá½»¹ýÈ¥ÁË£¬ÓôÃÆ£¬Ô­ÒÔΪ³ÌÐò±»¸Ä´íÁË£¬¼ì²é±¾µØ»¹ÊÇûÈκÎÎÊÌ⣬¼ ......

asp.netµÄÔÚÏßÈËÊýͳ¼Æ

Ò»°ãÊÇ·ÅÔÚGlobal.asaxÖУ¬´úÂëÈçÏ£º
<%@ Application Language="C#" %>
<mce:script runat="server"><!--
void Application_Start(object sender, EventArgs e)
{
// ÔÚÓ¦ÓóÌÐòÆô¶¯Ê±ÔËÐеĴúÂë
//Application["online"] = 10;//ÉèÖÃĬÈÏÔÚÏßÈËÊý,ÔÚÐéÄâ¿Õ¼äÉÏ£¬ÕâÀï²»»á ......

¹ØÓÚASP.NET¿Ø¼þÔÚ±àÒëʱÕÒ²»µ½µÄ½â¾ö·½°¸

     ±¾ÈË¿ª·¢ASP.NETÒÑÓÐÁ½Äê¶àÁË¡£Ì¸ÆðASP.NETÕæÊÇÈÃÎÒ»¶Ï²ÈÃÎÒÓÇ¡£×òÌìÓÖ³öÏÖÁËÄǸöÆæ¹ÖµÄÎÊÌ⣬¾ÍÊÇÔÚÒ³ÃæÍêȫдºÃºó£¬ÖØÐÂÉú³Éʱ±¨:XXX(Ò³ÃæÃû)²»°üº¬(XXX)µÄ¶¨Òå¡£ÔÚCSÎļþÏÂÊÇ¿ÉÒÔÓà this.xxx д³öÀ´µÄ£¬Ò³ÃæÉÏҲûÎÊÌâ¡£ÔÚ½â¾ö·½°¸ÖÐÖØÐÂÉú³ÉÒ³ÓÖ¿ÉÒÔ£¬ÖØÐÂÉú³ÉÍøÕ¾¾Í»á±¨Õâ¸ö´íÎó¡£½«this.XXX ......

ÀûÓÃASP.NET¼¼Êõ¶¯Ì¬Éú³ÉHTMLÒ³Ãæ

ÎÄÕ³ö´¦£ºhttp://hi.baidu.com/richiezheng/blog/item/8bb94b8692315b3867096efa.html
ÀûÓÃASP.NET¼¼Êõ¶¯Ì¬Éú³ÉHTMLÒ³Ãæ
˼·
¡¡¡¡1. ÀûÓÃÈçDw-MxÕâÑùµÄ¹¤¾ßÉú³Éhtml¸ñʽµÄÄ£°å£¬ÔÚÐèÒªÌí¼Ó¸ñʽµÄµØ·½¼ÓÈëÌØÊâ±ê¼Ç(Èç$htmlformat$),¶¯Ì¬Éú³ÉÎļþʱÀûÓôúÂë¶ÁÈ¡´ËÄ£°å£¬È»ºó»ñµÃǰ̨ÊäÈëµÄÄÚÈÝ£¬Ìí¼Óµ½´ËÄ£°åµÄ±ê¼ÇλÖÃÖ ......

LiteralÓëlabelµÄÇø±ð (asp.net C#)


Ò».Literal Web ·þÎñÆ÷¿Ø¼þ¸ÅÊö£¨ÕªÓÚMSDN£©
¿ÉÒÔʹÓà Literal Web ·þÎñÆ÷¿Ø¼þ×÷ΪҳÃæÉÏÆäËûÄÚÈݵÄÈÝÆ÷¡£Literal ×î³£ÓÃÓÚÏòÒ³ÃæÖж¯Ì¬Ìí¼ÓÄÚÈÝ¡£
Literal ¿Ø¼þ±íʾÓÃÓÚÏòÒ³ÃæÌí¼ÓÄÚÈݵļ¸¸öÑ¡ÏîÖ®Ò»¡£¶ÔÓÚ¾²Ì¬ÄÚÈÝ£¬ÎÞÐèʹÓÃÈÝÆ÷£¬¿ÉÒÔ½«±ê¼Ç×÷Ϊ HTML
Ö±½ÓÌí¼Óµ½Ò³ÃæÖС£µ«ÊÇ£¬Èç¹ûÒª¶¯Ì¬Ìí¼ÓÄÚÈÝ£¬Ôò±ØÐ뽫ÄÚÈÝÌí¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ