(4)ASP.NET内置对象

2021-06-27 09:03

阅读:562

标签:asp   img   box   textbox   默认页   参数   异常   传递参数   this   

一、Response

把数据从服务端发送到客户端

Response.Write() 

在页面上输出数据

 

Response.WriteFile(@"F:\WriteFile.txt")//文件必须存放否则报异常

 

页面跳转并传递参数

Response.Redirect(“~/welcome.aspx“)

传递参数时,?地址和参数的分隔符,

Response.Redirect(“~/welcome.aspx“?p1=one&p2=two)

 

默认页面

技术分享

按钮方法

    protected void Button1_Click(object sender, EventArgs e)
    {
        string name = this.TextBox1.Text;
        Response.Redirect("~/welcome.aspx?Name="+name);
    }

 

welcome.aspx页面

加载页面时执行

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = Request.Params["name"];
        Response.Write(name);
    }

 

二、

Request

 

(4)ASP.NET内置对象

标签:asp   img   box   textbox   默认页   参数   异常   传递参数   this   

原文地址:http://www.cnblogs.com/buchizaodian/p/7148126.html


评论


亲,登录后才可以留言!