ASP.NET在页面间传值的方法

        1,querystring 地址栏传值(response.redirect(a.aspx?name=1)=>request["name"]) 
        2,session        Session("param1")="111" ; string str1=Session("param1").ToString();
        3,缓存
        4,cookie        HttpCookie cookie_name=new HttpCookie("name");
                        cookie_name.Value=Label1.text;
                        Response.AppendCookie(cookie_name);
                        server.transfer("Default2.aspx");       
                        str1== Request.Cookies["name"].Value.ToString();
        5,Application    Application("param1")="111";   str1=Application("param1").ToString();
        6,server.transfer
                首先在default2.aspx中添加:<%@ Reference Page="~/Default1.aspx %> 或者<%@ PreviousPageType VirtualPath="~/Default1.aspx" %>

 

     7,跨页投递:(TextBox)PresviousPage.FindControl("TextBox1");

posted on 2010-06-15 21:12  Henry_Wang  阅读(164)  评论(0编辑  收藏  举报

导航