Session State Issue
<p>When visiting a page, I am storing a value in session state. When I click back on the browser, the value in session reverts to its original value. Why does this happen? I am not resetting  the value when i go back.</p>

<p>This happens on iPhone and iPad - all other browsers do NOT roll back the session state value.</p>

<p>Thanks in advance.</p>

<p>I am using this javascript code (code in both pages is identical):</p>

<pre><code>function pageLoad() {
    // Get the current url path
    var url = document.URL;

    PageMethods.IsNavigatingBackward(url, handleCallback);
}

function handleCallback(isBackward) {
    if (isBackward) {
        // Go back to previous page
        history.back();
    }
    else {
        // Set the current url in the session
        var url = document.URL;

        PageMethods.SetCurrentPage(url, getLocation);
    }
}
</code></pre>

<p>And the code behind:</p>

<pre><code>[WebMethod]
public static bool IsNavigatingBackward(Uri url)
{
    string currentPath = url.LocalPath;
    string lastPath = (string)HttpContext.Current.Session["LastPage"];
    bool isBackward = false;

    NavigationList table = NavigationList.GetInstance();

    if (table.IsBackwardNavigation(currentPath, lastPath))
    {
        isBackward = true;
    }

    return isBackward;
}

[WebMethod]
public static void SetCurrentPage(Uri url)
{
    HttpContext.Current.Session["LastPage"] = url.LocalPath;
}
</code></pre>
