UserControl.Session プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > UserControl.Session プロパティの意味・解説 

UserControl.Session プロパティ

現在の Web 要求対する HttpSessionState オブジェクト取得します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As UserControl
Dim value As HttpSessionState

value = instance.Session
public HttpSessionState Session { get; }
public:
property HttpSessionState^ Session {
    HttpSessionState^ get ();
}
/** @property */
public HttpSessionState get_Session ()
public function get Session
 () : HttpSessionState

プロパティ
UserControl インスタンス格納している Page関連付けられた HttpSessionState オブジェクト

使用例使用例

ユーザー コントロールSession プロパティに値を追加する例を次に示しますmyControl.Session.Add 構文が、ユーザー コントロールとそのページ関連付けられているセッションに、2 つTextBox Web サーバー コントロールの値を挿入してます。

' Saves state information which is used by display handler after the
 postback has occured.

Sub SubmitBtn_Click(Sender As Object,
 e As EventArgs) 

    ' Clear all values from session state of 'Page'.
    Session.Clear()

    ' Populate Session State of UserControl with the values entered
 by user.
    myControl.Session.Add("username",myControl.user.Text)
    myControl.Session.Add("password",myControl.password.Text)

    ' Add UserControl state to the SessionState object of Page.
    Session(myControl.user.Text)= myControl
    Display.Enabled = true
End Sub

Sub Display_Click(Sender As Object,e
 As EventArgs)

    Dim position As Integer
 = Session.Count - 1

    ' Extract stored UserControl from the session state of page.
    Dim tempControl As LogOnControl = CType(Session(Session.Keys(position))
,LogOnControl)

    ' Use SessionState of UserControl to display previously typed information.
    txtSession.Text = "<br><br>User:"
 + tempControl.Session("username") + "<br>Password
 : " + tempControl.Session("password")
    Display.Enabled = false
End Sub
// Save state information which is used by display handler after the
 postback has occured.
void SubmitBtn_Click(Object sender, EventArgs e) 
{
  // Clear all values from session state of 'Page'.
  Session.Clear();

  // Populate Session State of UserControl with the values entered by
 user.
  myControl.Session.Add("username",myControl.user.Text);
  myControl.Session.Add("password",myControl.password.Text);

  // Add UserControl state to the SessionState object of Page.
  Session[myControl.user.Text]= myControl;
  display.Enabled = true;
}

void Display_Click(Object sender, EventArgs e)
{
  int position = Session.Count - 1;

  // Extract stored UserControl from the session state of page.
  LogOnControl tempControl = (LogOnControl)Session[Session.Keys[position]];

  // Use SessionState of UserControl to display previously typed information.
  txtSession.Text = "<br><br>User:" + tempControl.Session["username"]
 + "<br>Password : " + tempControl.Session["password"];
  display.Enabled = false;
}
// Save state information which is used by display handler after the
// postback has occured.
void SubmitBtn_Click(Object sender, EventArgs e) 
{
    // Clear all values from session state of 'Page'.
    get_Session().Clear();
    // Populate Session State of UserControl with the values entered by
 user.
    myControl.get_Session().Add("username",myControl.user.get_Text());
    myControl.get_Session().Add("password",myControl.password.get_Text());
    // Add UserControl state to the SessionState object of Page.
    get_Session() .set_Item( myControl.user.get_Text() , myControl );
    display.set_Enabled(true);
} //SubmitBtn_Click

void Display_Click(Object sender, EventArgs e)
{
    int position = get_Session().get_Count() - 1;
    // Extract stored UserControl from the session state of page.
    LogOnControl tempControl = (LogOnControl)(get_Session().get_Item(
        get_Session().get_Keys().get_Item(position)));
    // Use SessionState of UserControl to display previously typed
    // information.
    txtSession.set_Text("<br><br>User:" 
        + tempControl.get_Session().get_Item("username") + "<br>Password
 : "
        + tempControl.get_Session().get_Item("password"));
    display.set_Enabled(false);
} //Display_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からUserControl.Session プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からUserControl.Session プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からUserControl.Session プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

UserControl.Session プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



UserControl.Session プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS