「HttpContext クラスによる別ページへの値渡し」の編集履歴(バックアップ)一覧に戻る
HttpContext クラスによる別ページへの値渡し - (2008/02/06 (水) 14:18:23) のソース
// 現在のページ名 *&this_page() **概要 タイトルのまんま。 **前提条件 -[[新しいwebサイトの作成]] **手順 default.aspx.vb を以下のように変更。 #highlight(vb.net){ Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object _ , ByVal e As System.EventArgs) Handles Button1.Click Context.Items.Add("str1", "hoge") Context.Items.Add("str2", "test") Context.Server.Transfer("default2.aspx") End Sub End Class } default2.aspx.vb を以下のように変更 #highlight(vb.net){ Partial Class Default2 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object _ , ByVal e As System.EventArgs) Handles Me.Load Dim str_temp As String = "" str_temp &= "str1: " & Context.Items("str1") str_temp &= "<br>" str_temp &= "str2: " & Context.Items("str2") Response.Write(str_temp) End Sub End Class } &img(画像.jpg)