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;
Ïà¹ØÎĵµ£º
ASP.NETÒ³ÃæÌø×ªÓÐʲô·½·¨ÄØ£¿£¬ÏÖÔÚ¸ø´ó¼Ò½éÉÜÈýÖÖ·½·¨£¬ËûÃǵÄÇø±ðÊÇÊ²Ã´ÄØ£¿ÈÃÎÒÃÇ¿ªÊ¼°É£º ASP.NETÒ³ÃæÌø×ª1¡¢response.redirect Õâ¸öÌø×ªÒ³ÃæµÄ·½·¨Ìø×ªµÄËٶȲ»¿ì£¬ÒòΪËüÒª×ß2¸öÀ´»Ø(2´Îpostback)£¬µ«Ëû¿ÉÒÔÌø×ªµ½ÈκÎÒ³Ãæ£¬Ã»ÓÐÕ¾µãÒ³ÃæÏÞÖÆ(¼´¿ÉÒÔÓÉÑÅ»¢Ìøµ½ÐÂÀË)£¬Í¬Ê±²»ÄÜÌø¹ýµÇ¼±£»¤¡£µ«ËÙ¶ÈÂýÊÇÆä×î´óȱÏÝ!r ......
ÊÂÎñ´¦ÀíÊÇÔÚÊý¾Ý´¦Àíʱ¾³£Óöµ½µÄÎÊÌ⣬¾³£Óõ½µÄ·½·¨ÓÐÒÔÏÂ3ÖÖ×ܽáÕûÀíÈçÏ£º ·½·¨1£ºÖ±½ÓдÈëµ½sql ÖÐ ÔÚ´æ´¢¹ý³ÌÖÐʹÓà BEGIN TRANS, COMMIT TRANS, ROLLBACK TRANS ʵÏÖ Óŵ㣺ÊÂÎñÂß¼°üº¬ÔÚÒ»¸öµ¥¶ÀµÄµ÷ÓÃÖУ¬ÓÐÔËÐÐÒ»¸öÊÂÎñµÄ×î¼ÑÐÔÄÜ£¬Á¢ÓÚÓ¦ÓóÌÐò¡£ÏÞÖÆ£º ÊÂÎñÉÏÏÂÎĽö´æÔÚÓÚÊý¾Ý¿âµ÷ÓÃÖУ¬Êý¾Ý¿â´úÂëÓëÊ ......
ÔÚASP.NET³öÏÖ´íÎóʱ£¬Ó¦¸ÃÏȼì²éASP.NET»·¾³ÊÇ·ñÕýÈ·´î½¨£¬±ÈÈçÒÔϼ¸¸ö·½Ã棺
1¡¢ÊÇ·ñ°²×°ÏàÓ¦°æ±¾µÄ.NET Framework³ÌÐò£¬²¢´òºÃÁ˲¹¶¡¡£
2¡¢IISÊÇ·ñ°²×°ÔËÐÐÕý³££¬Õ¾µã·¾¶¼°ASP.NET°æ±¾ÊÇ·ñÅäÖÃÕýÈ·¡£
3¡¢ÔÚIIS WEB·þÎñÀ©Õ¹ÖУ¬ÊÇ·ñÔÊÐíÁËASP.NETÀ©Õ¹¡£
4¡¢ÊÇ·ñÓа²È«·À»¤Èí¼þ½ûÖ¹ÏòWindowsºÍTempÎļþ¼ÐдÈëÎÄ ......
ASP.NET ³É¹¦µÄÆäÖÐÒ»¸öÔÒòÔÚÓÚËü½µµÍÁË Web ¿ª·¢ÈËÔ±µÄÃż÷¡£¼´±ãÄú²»ÊǼÆËã»ú¿ÆÑ§²©Ê¿Ò²¿ÉÒÔ±àд ASP.NET ´úÂë¡£ÎÒÔÚ¹¤×÷ÖÐÓöµ½µÄÐí¶à ASP.NET ¿ª·¢ÈËÔ±¶¼ÊÇ×Ôѧ³É²ÄµÄ£¬ËûÃÇÔÚ±àд C# »ò Visual Basic® ֮ǰ¶¼ÔÚ±àд Microsoft® Excel® µç×Ó±í¸ñ¡£ÏÖÔÚ£¬ËûÃÇÔÚ±àд Web Ó¦ÓóÌÐò£¬×ܵÄÀ´Ëµ£¬ËûÃÇËù×öµÄ¹¤ ......