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;
Ïà¹ØÎĵµ£º
1.ʲôÊÇcookie?
cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæÓû§ÇëÇó£¬ÔÚweb·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Óû§Ã¿´Î·ÃÎÊÕ¾µãµÄʱºò£¬
webÓ¦ÓóÌÐò¶¼¿ÉÒÔ¶ÁÈ¡cookie°üº¬µÄÐÅÏ¢¡£
¼ÙÉèÔÚÓû§ÇëÇóÄúµÄÍøÕ¾µÄij¸öÒ³ÃæÊ±£¬ÄúµÄÓ¦ÓóÌÐò²»½öÊÇ·µ»ØÇëÇóµÄÒ³Ãæ¡£Í¬Ê±Ò²·µ»ØÒ»¸ö°üº¬ÈÕÆÚ
ºÍʱ¼äµÄcookie¡£Óû§µÄä¯ÀÀÆ÷ÔÚ»ñµÃÒ³ÃæµÄͬʱҲ»ñµÃ ......
ÉèÖÃSharpDevelop£¬Ê¹ÆäÄܱàдºÍÔËÐÐAsp.net¡£
ÔÚ¿´ÏÂÎĵÄʱºò£¬ÇëÈ·¶¨ÄúµÄϵͳװÉÏÁËIIS£¬FontPageÀ©Õ¹£¬×°ÁË.Net¿ò¼Ü¡£ºÃÏÖÔÚ¿ªÊ¼ÎҵĽ²Êö¡£
Èç¹ûÄú×°µÄ.Net¿ò¼ÜÊÇ1.1°æµÄ£¬ÇëÉú³ÉÒÔÏÂBATÎļþ¡£
Îļþ£ºAsp.Net_1.1_Setup.bat
c:
......
using System;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
public partial class images_code : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string chkCode = string.Empty;
//ÑÕÉ«ÁÐ±í£¬ÓÃÓÚÑéÖ¤Âë¡¢ÔëÏß¡¢Ôëµã
Color[] col ......
ÔÚѧϰ¹ý³ÌÖз¢ÏÖÈç¹ûÒªÉÏ´«µÄÕÕÆ¬ºÜ´óµÄ»°£¬ËÙ¶È»áºÜÂý£¬ËùÒÔ²ÉÓÃÁËÔÚÉÏ´«ÕÕÆ¬Ê±Í¬Ê±ÉÏ´«ËõÂÔͼµÄ·½Ê½£¬ÕâÑù¾Í¿ÉÒԼȲ»Ó°Ïì¶à¸öͼƬµÄä¯ÀÀ£¬ÓÖ²»Ó°Ïì²é¿´¾ßÌåµÄͼƬ¡£
ÐèÒªÓõ½µÄÃüÃû¿Õ¼ä£º
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
#region ±£´æÉÏ´«Îļþ£¬·½·¨Ãû£ºUploadSave(string ......
ÔÚûÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³ÖУº
Response.Write("<script>alert('¹§Ï²Äú£¬Òѳɹ¦¼ÓÈëµ½ÄúµÄÈ˲ſ⣡');</script>");
ÔÚÓÐ<asp:UpdatePanel ID="up" runat="server"> <ContentTemplate>ÎÞˢл·¾³Ö ......