Context Object in ASP.Net

Context Object 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 *

4 + 5 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">