How to assign page property to another page in ASP.NET

I have a page called Default.aspx, on Default.aspx I have a property

 protected string pageNo = string.Empty;
 public string PageNo
        {
            get { return pageNo; }
            set { pageNo = value; }
        }

and the second page myPage.aspx has a similar property. Now I want to access the property of the Default.aspx page on myPage.aspx or assign it in the property of the myPage.aspx page. Is it possible, if so, how to do this?

+3
source share
3 answers

you are doing cross-publishing. you can use page.PreviousPage. This is needed from asp.net 3.5 or later.

+1
source

, . MyPage.aspx, Default.aspx . - , URL,...

+1

You can use HttpContext.Items :

An example of use in the article:

HttpContext.Items - request cache storage

0
source

Source: https://habr.com/ru/post/1720915/


All Articles