this.Button1.Attributes.Add("onclick", "window.document.location.href='2.aspx'");
不能用
protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write("<script>window.document.location.href='2.aspx';</script>");
    } 
可用应该是一样的功能吧