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

ASP.NETÒ³Ãæ´«Öµ_µÚ¾Åƪ_Cache

+++ PassDatatableByCache01.aspxÒ³Ãæ
++ ҳ̨´úÂëÈçÏ£º
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="ÓÃCache´«Êý¾Ý¼¯"></asp:Button>
++ ºǫ́´úÂëÈçÏ£º
protected void Button1_Click(object sender, EventArgs e)
{
  string connStr = "Data Source=ora11g;uid=scott;pwd=tiger;unicode=true";
  string sqlStr = "SELECT * from EMP";
  OracleDataAdapter da = new OracleDataAdapter(sqlStr, connStr);
  DataTable dt = new DataTable();
  da.Fill(dt);
  Cache.Insert("statistic", dt,
      null,
      DateTime.Now.AddMinutes(10), Cache.NoSlidingExpiration);
  Response.Redirect("PassDatatableByCache02.aspx");
}
+++ PassDatatableByCache02.aspxÒ³Ãæ
++ Ò³Ãæ´úÂëÈçÏ£º
(ÂÔ)
++ ºǫ́´úÂëÈçÏ£º
protected void Page_Load(object sender, EventArgs e)
{
  if (Cache.Get("statistic") != null)
  {
    DataTable dt = (DataTable)Cache.Get("statistic");
    foreach (DataRow dr in dt.Rows)
    {
        Response.Write(dr[0].ToString() + "</br>");
    }
  }
  else
  {
    Response.Write("Cache»º´æÖÐûÓÐÄÚÈÝ£¡");
  }
}
+++ ˵Ã÷
(1) ±¾ÀýÓÃCache´«µÝÊý¾Ý¼¯£»
(2) ÓÃCache´«µÝÊý¾Ý¼¯Òª±ÈSession¿ÉÐеö࣬CacheʹÓøüÁé»î£¬¶øÇÒ¿ÉÒÔÉèÖùýÆÚʱ¼ä»òÊÇ»º´æÒÀÀµ£»
(3) ÔÚ±¾BLOGµÄCache·ÖÀàÖÐÓÐCacheµÄÏ꾡ʹÓá£


Ïà¹ØÎĵµ£º

Asp.Netǰ̨µ÷Óúǫ́±äÁ¿

1.Asp.NetÖм¸ÖÖÏàËƵıê¼Ç·ûºÅ: < %=...%>< %#... %>< % %>< %@ %>½âÊͼ°Ó÷¨
´ð: < %#... %>: ÊÇÔڰ󶨿ؼþDataBind()·½·¨Ö´ÐÐʱ±»Ö´ÐУ¬ÓÃÓÚÊý¾Ý°ó¶¨
Èç: < %# Container.DataItem("tit") %>
< %= %>: ÔÚ³ÌÐòÖ´ÐÐʱ±»µ÷Ó㬿ÉÒÔÏÔʾºǫ́±äÁ¿Öµ
Èç:
*.aspxÖУº < %= a ......

asp.netÒ¹»°Ö®Ê®Ò»£ºweb.configÏê½âÊÕ²Ø

ÔÚ¿ª·¢Öо­³£»áÓöµ½ÕâÑùµÄÇé¿ö£¬ÔÚ²¿Êð³ÌÐòʱΪÁ˱£ÃÜÆð¼û²¢²»½«Ô´´úÂëËæÏîĿһͬ·¢²¼£¬¶øÎÒÃÇ¿ª·¢Ê±µÄ»·¾³Ó벿Êð»·¾³¿ÉÄܲ»Ò»Ö£¨±ÈÈçÊý¾Ý¿â²»Ò»Ñù£©£¬Èç¹ûÔÚ´úÂëÖб£´æÕâЩÅäÖÃÕâЩÐÅÏ¢²¿ÊðʱÐèÒªµ½Óû§ÄÇÀï¸ü¸Ä´úÂëÔÙÖØбàÒ룬ÕâÖÖ²¿Êð·½Ê½·Ç³£Âé·³¡£
ÔÚ.net ÖÐÌṩÁËÒ»ÖÖ±ã½ÝµÄ±£´æÏîÄ¿ÅäÖÃÐÅÏ¢µÄ°ì·¨£¬ÄǾÍÊÇÀûÓÃÅäÖ ......

ASP.NET ¶¨Ê±Ö´ÐÐÒ»¶Î´úÂë Global.asax

ÔÚGlobal.asaxÆô¶¯Ò»ÌõÏ߳̾ÍokÁË£¬ÏÂÃæÊÇÆô¶¯Ï̶߳¨Ê±Ð´ÎļþµÄÀý×Ó
ÔÚGlobal.asax
C# code:
<%@ Application Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">   
 string LogPath;  ......

asp.net ·¢²¼ÍøÕ¾

asp.net ·¢²¼ÍøվʱÓÐÈý¸öÑ¡Ï
1¡¢ÔÊÐí¸üдËÔ¤±àÒëÕ¾µã£ºasp.net web Ò³Ãæͨ³£°üº¬Á½¸öÒ³Ã棬һ¸ö¼´ .aspx Ò³£¬»¹ÓÐÒ»¸ö .aspx.cs Îļþ£¬ºóÒ»¸öÎļþÊÇ»ù±¾Î¯ÍеÄʼþÏìÓ¦Îļþ´úÂ룻´Ë´¦ÔÊÐí¸üдËÔ¤±àÒëÕ¾µãµÄÒâ˼¾ÍÊÇ£º.aspx Ò³¿É¸ù¾ÝÐèÒª½øÐÐÒ»¶¨µÄ¸üУ¬¶ø .aspx.cs ±àÒë³ÉµÄ .dll ±£³Ö²»±ä£»ÁíÍ⣬Èç¹û·¢²¼Íøվʱֻ ......

Asp.netÒ³Ãæ´«ÖµµÄ¼¸ÖÖ·½Ê½

Ò»¡¢Ê¹ÓÃQueryString²ÎÊý
QueryString½«´«µÝµÄÖµÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸ÖУ¬ÊÇÒ»Öַdz£¼òµ¥Ò²Ê¹ÓñȽ϶àµÄ´«Öµ·½Ê½¡£
Èç¹û´«µÝÒ»¸ö»ò¶à¸ö°²È«ÐÔÒªÇ󲻸߻òÊǽṹ¼òµ¥µÄÊýֵʱ£¬¿ÉÒÔʹÓÃÕâ¸ö·½·¨
/// <summary>
/// ʹÓÃQueryString±äÁ¿
/// </summary>
/// <param name="param1"></param>
/// ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ