asp.netÉú³É¾²Ì¬ÍøÒ³
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
namespace xmlDemo
{
/**//// <summary>
/// staticWeb µÄժҪ˵Ã÷¡£
/// </summary>
public class staticWeb : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// ÔÚ´Ë´¦·ÅÖÃÓû§´úÂëÒÔ³õʼ»¯Ò³Ãæ
}
public bool WriteFile(string strText,string strContent,string strAuthor)
{
string path = Server.MapPath("~/news/");
Encoding code = Encoding.GetEncoding("gb2312");
// ¶ÁÈ¡Ä£°åÎļþ
string temp = Server.MapPath("~/news/text.htm");
StreamReader sr=null;
StreamWriter sw=null;
string str="";
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd(); // ¶ÁÈ¡Îļþ
}
catch(Exception exp)
{
HttpContext.Current.Response.Write(exp.Message);
HttpContext.Current.Response.End();
sr.Close();
}
string htmlfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".htm";
// Ìæ»»ÄÚÈÝ
// Õâʱ,Ä£°åÎļþÒѾ¶ÁÈëµ½Ãû³ÆΪstrµÄ±äÁ¿ÖÐÁË
str =str.Replace("ShowArticle",strText); //Ä£°åÒ³ÖеÄShowArticle
str = str.Replace("biaoti",strText);
str = str.Replace("content",strContent);
str = str.Replace("author",strAuthor);
// дÎļþ
try
{
sw = new StreamWriter(path + htmlfilename , false, code);
sw.Write(str);
sw.Flush();
}
catch(Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
HttpContext.Current.Response.End();
}
finally
{
sw.Close();
}
return true;
Ïà¹ØÎĵµ£º
×òÌìÍíÉÏÓÐÅóÓÑÔÚcsdn£¨Çó¹¤×÷Á÷¿ª·¢×ÊÁÏ £©ÉÏÒª¹ØÓÚ¹¤×÷Á÷µÄ×ÊÁÏ£¬ÕýºÃÇ°¶Îʱ¼äÑо¿Õâ·½ÃæµÄ¶«Î÷£¬ÊÕ¼¯ÁËһЩasp.net·½ÃæµÄ¹¤×÷Á÷×ÊÁÏ£¬ÐÄÏë·´Õý¶¼ÊÇÍøÉÏÀ´µÄºÎ²»Ô츣ϺóÀ´ÈË£¬ÓÚÊÇ°ÑÄÇЩ¾õµÃ»¹¿ÉÒԵĴòÁ˸ö°ü£¬·Åµ½ÎÒ×Ô¼ºµÄ¿Õ¼ä£¨¸ÕÉêÇ뻹ûÕýʽʹÓã©ÉϹ©´ó¼ÒÏÂÔØ.
ÒÔÏÂÊÇ´ó¸ÅµÄĿ¼£¬Ã»Ê±¼äд½éÉÜ£¬¼òµ¥ ......
1.ʲôÊÇcookie?
cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæÓû§ÇëÇó£¬ÔÚweb·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Óû§Ã¿´Î·ÃÎÊÕ¾µãµÄʱºò£¬
webÓ¦ÓóÌÐò¶¼¿ÉÒÔ¶ÁÈ¡cookie°üº¬µÄÐÅÏ¢¡£
¼ÙÉèÔÚÓû§ÇëÇóÄúµÄÍøÕ¾µÄij¸öÒ³Ãæʱ£¬ÄúµÄÓ¦ÓóÌÐò²»½öÊÇ·µ»ØÇëÇóµÄÒ³Ã档ͬʱҲ·µ»ØÒ»¸ö°üº¬ÈÕÆÚ
ºÍʱ¼äµÄcookie¡£Óû§µÄä¯ÀÀÆ÷ÔÚ»ñµÃÒ³ÃæµÄͬʱҲ»ñµÃ ......
Èç¹ûÄãÒѾÓн϶àµÄÃæÏò¶ÔÏ󿪷¢¾Ñ飬Ìø¹ýÒÔÏÂÕâÁ½²½£º
¡¡¡¡µÚÒ»²½¡¡ÕÆÎÕÒ»ÃÅ.NETÃæÏò¶ÔÏóÓïÑÔ£¬C#»òVB.NET ÎÒÇ¿ÁÒ·´¶ÔÔÚûϵͳѧ¹ýÒ»ÃÅÃæÏò¶ÔÏó(OO)ÓïÑÔµÄÇ°ÌáÏÂȥѧASP.NET¡£ ASP.NETÊÇÒ»¸öÈ«ÃæÏò¶ÔÏóµÄ¼¼Êõ£¬²»¶®OO£¬ÄǾø¶Ôѧ²»ÏÂÈ¥!
¡¡¡¡µÚ¶þ²½¡¡¶Ô.NET FrameworkÀà¿âÓÐÒ»¶¨µÄÁ˽⠿ÉÒÔͨ¹ý¿ª·¢Windows FormÓ¦ÓÃ³Ì ......
ÔÚûÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³ÖУº
Response.Write("<script>alert('¹§Ï²Äú£¬Òѳɹ¦¼ÓÈëµ½ÄúµÄÈ˲ſ⣡');</script>");
ÔÚÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³Ö ......