What is Context in ASP.Net?

Context in ASP.Net

  • The context object is used to pass values from one page to another page.

    Syntax :- Context.Items[“value”] = “MeeraAcademy”;

    Example :-

    If you want to send a data from ‘send.aspx’ page to ‘receivepage.aspx’ page.
    First, we have to create a Context and then assign value to Context Object.


    Redirect the page to the next page


    After redirecting a page we have to receive that Context value in string variable.

    str Name=Context[“Name”].ToString();

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *