Postback message and browser writeback issues in asp.net

I am working on a web application. I have a grid that shows data to the user. When a user clicks on any grid line, he redirects the user to another page, since we have an asp link control in the column. Problems

My code is like

if (!Page.IsPostBack)
             {
                //CODE
             }

When the user presses the BROWSER BACK button, he does not execute the CODE. Just show the data from CACHE. How can I execute the CODE, click on the browser button?

+4
source share
2 answers

ASP.Net. Windows. , .

:

  • . URL.
  • . , . "" .
  • "" "? ID = 42" URL-

"" , postback HTTP Post. .

, GET. -.

+2

, .

protected void Page_Load(object sender, EventArgs e)
{
    Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
    Response.Cache.SetValidUntilExpires(false);
    Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetNoStore();

    if (!Page.IsPostBack)
    {
            //CODE
    }   
}   
+1

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


All Articles