Clear SESSION variable on webform exit

Posted on 2005-04-19
Last Modified: 2008-01-09
Hi ,
I am working on a Purchase Order application in
I have a form that lets the user add a PO , entering its header and the details part of the PO.
I save the details part of the PO in a Datatable temporarily , till the user selects on ADD to add the PO to the database.
I store the Datatable in a SESSION variable.
What I want to do is clear this SESSION variable when the user exits the PO form. (i.e when the user moves to any other form in the application)

How can I do this??
Question by:TetraSA
    LVL 12

    Expert Comment

    You can do
    session("po") = nothing
    in the page_load event handler of any other forms.
    LVL 9

    Accepted Solution

    Have you considered storing this in ViewState or another object, where it will not be persisted when leaving the page.

    state management overview

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    jquery, aspx 10 34 c# execute .bat server side problem 6 45 mvc C# 2 27
    popup message 3 17
    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now