asp.netÈÕÖ¾
string path = "...\\Debug\\log.txt";
if (!File.Exists(path))
{
StreamWriter sw1;
sw1 = File.CreateText(path);
sw1.Close();
}
string str = System.DateTime.Now.Year.ToString() + "Äê" + System.DateTime.Now.Month.ToString() + "ÔÂ" + System.DateTime.Now.Day.ToString() + "ÈÕ " + System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString() + ":" + System.DateTime.Now.Second.ToString() + " " + "Êý¾ÝWeb·þÎñÎÞ·¨·ÃÎÊ»òÕßÍøÂ粻ͨ. ";
StreamWriter sw = File.AppendText(path);
sw.WriteLine(str);
sw.Close();
return;
Ïà¹ØÎĵµ£º
1.µ¯³ö¶Ô»°¿ò.
a. µ¯³ö¶Ô»°¿ò£º
C# codeClientScript.RegisterStartupScript(this.GetType(), "",
"<script>window.alert('¸Ã»áԱûÓÐÌá½»ÉêÇë,ÇëÖØÐÂÌá½»£¡')</script>");
b.תÏòÖ¸¶¨Ò³Ãæ
C# code Response.Write("
<script>window.location='http://www. ......
»º´æµÄÖØÒªÐԾͲ»ÓÃÔÙÇ¿µ÷ÁË£¬@OutputCache¸øÎÒÃÇÌṩÁËÒ»ÖÖÉùÃ÷µÄ·½Ê½(¶ÔÓ¦µÄ»¹Óбà³ÌµÄ·½Ê½)À´¿ØÖÆÒ³ÃæºÍÓû§¿Ø¼þµÄ»º´æ²ßÂÔ£¬ÕâÊÇÒ»ÖÖ×î¼òµ¥Ö±½ÓµÄÍøÕ¾ÓÅ»¯·½Ê½¡£
»¹ÊÇÏÈÀ´¹ýÒ»±é@OutpuCacheËùÓеÄÊôÐÔ£¬¹²ÓÃ11¸öÊôÐÔ£¬Õâ¸öÖ¸Áî¿ÉÒÔÓÃÓÚÒ³Ãæ(.aspx)ºÍÓû§¿Ø¼þ(.ascx)
ÊôÐÔ
Duration
Ò³»òÓû§¿Ø¼þ½øÐлº´æµÄʱ¼ä£¬µ¥Î ......
»º´æÊǰÑÓ¦ÓóÌÐòÖеÄÐèҪƵ·±¡¢¿ìËÙ·ÃÎʵÄÊý¾Ý±£´æÔÚÄÚ´æÖеıà³Ì¼¼Êõ£¬Í¨³£ÓÃÀ´Ìá¸ßÍøÂçµÄÏìÓ¦ËÙ¶È¡£ÔÚASP.NETÖÐʹÓÃCacheÀàÀ´¹ÜÀí»º´æ¡£ÏÂÃæÏêÊö¿Ø¼þ¼¶Êý¾Ý»º´æ¹¦ÄܺÍÒ³Ãæ¼¶Êý¾Ý»º´æ¹¦ÄܵÄʵÏÖ£º
(1)Êý¾Ý¿â»º´æÒÀÀµ
Êý¾Ý¿â»º´æÒÀÀµÓÉSqlCacheDependencyÀà¹ÜÀí£»
Êý¾Ý¿â»º´æÒÀÀµµÄÓŵ㣺
1¡¢Ìá¸ßÊý¾Ý³ÊÏÖËÙ¶È£¬Ã¿´Î»ñ ......
ASP.NET´ò¿ªÐ´°¿Ú·½·¨Ò»:
Response.Write(" <script language=\"javascript\">window.open('aaa.aspx','д°¿Ú,\"toolbar=yes,location=no,directories=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes\"); </script>");
ÕâÖÖ·½Ê½´úÂëÿ´ÎÊÇÉú³ÉÔÚÒ³Ãæ×î¶¥¶Ë
ASP.NET´ò¿ªÐ´°¿Ú·½·¨¶þ:
stri ......
Çмǣ¬ÇÐ¼Ç DateTime.Now.Date.ToString("yyyyÄêMMÔÂddÈÕ"); //MM Òª´óд£¬·ñÔò»áÊÇ00,²»ÊÇÕæÊµµÄÔÂ·Ý private void getDate()
{
date.Text = DateTime.Now.Date.ToString("yyyyÄêMMÔÂddÈÕ"); //Õâ¸öËæÒâµÄ£ºyyyy-MM-dd Ò²¿ÉÒÔ
string Temp="";
switch (DateTime.Now.DayOfWeek)
{
case DayO ......