strange session problem
<p>I have this field in my session class:</p>

<pre><code>public bool IsCartRecentlyUpdated
{
    get
    {
        if (this.session["IsCartRecentlyUpdated"] != null)
        {
            return (bool)this.session["IsCartRecentlyUpdated"];
        }
        else
        {
            this.session["IsCartRecentlyUpdated"] = false;
            return (bool)this.session["IsCartRecentlyUpdated"];
        }
    }
    set
    {
        this.session["IsCartRecentlyUpdated"] = value;
    }
}
</code></pre>

<p>Whenever a user adds a product to the cart I put this value on true:</p>

<pre><code>  public void AddToCart(Product product, int quantity)
    {
        IsCartRecentlyUpdated = true;
     //other code for updating the cart
     }
</code></pre>

<p>Adding a product to the cart does a postback so I can <strong>show a message</strong> (ëg: <em>Product added succesfully</em>) in Page_Load of the General Master page where the shopping cart is located, when a product has just been added to the cart:</p>

<pre><code> protected void Page_Load(object sender, EventArgs e)
{
    if (this.sessionsUtil.IsCartRecentlyUpdated)
    {
        this.lblCartWarning.Text = (string)GetLocalResourceObject("CartWarning");
        imgCardLogos.Visible = false;
    }
    else
    {
        this.lblCartWarning.Text = String.Empty;
        imgCardLogos.Visible = true;
    }
//other code
//put it back to false to not show the message each time the page is loaded
this.sessionsUtil.IsCartRecentlyUpdated = false;
}
</code></pre>

<p>Well this code <strong>works</strong> great <strong>locally</strong> but on the <em>server</em> it does not <em>show the message</em> after adding the product to the cart but <em>on the second page loading</em>...
(I guess that on the server somehow the page is loading before the session var is updated - extremely strange)</p>

<p>Do you know why? I do not see any problem in the code...</p>
