ASP.NET how to access public properties?

前端 未结 5 705
难免孤独
难免孤独 2020-12-12 08:06

I have two pages page1.aspx and page2.aspx, both have code behind with partial classes. How do i access public property message on page1.aspx from page2.aspx ?



        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 08:41

    If you are NOT in a sessionless environment, then in the transmitter page, push your string (or your object - e.g., a Dictionary ) into session:

    Session("MyVar") = "WhatEver"
    

    In the receiver page, you can get it back with:

    MyPreviousVar = Session("MyVar")
    

提交回复
热议问题