asp.net 基础知识回顾1-response对象的write和redirect方法

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int i=1;
        if (!IsPostBack)
        {
            Response.Write("首次打开页面");

        }
        else
        {
            i++;
            Response.Write("第" +(string)i.ToString()+ "次打开页面");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        Response.Write("点击了按钮1");
      
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Write("点击了按钮2重定向前.");
        //Response.Redirect("Default.aspx");
        Response.Write("点击了按钮2重定向后.");
    }
}

posted @ 2008-02-14 20:45  遇到未来的自己  阅读(569)  评论(0编辑  收藏  举报