2013年11月3日 星期日

ASP.NET 網頁互傳值



a.aspx
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim Subm As HttpContext = HttpContext.Current
            Subm.Items.Add("Page_title", "Hello")
            Subm.Items.Add("temp_x","大家好" )
            Server.Transfer("b.aspx", True) '傳給b.aspx
        End If
    End Sub

b.aspx
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Dim Req As HttpContext = HttpContext.Current
            Page.Title = Req.Items("Page_title")
            Response.Write Req.Items("temp_x")
        End If
    End Sub

沒有留言:

張貼留言