I'd like to clear ASP.NET
session value when browser closed. I've onunload function defined in my html
page, but I don't know how can I clear session value in this Javascript method ?
<body onunload="myUnloadFunction()">
<script>
function myUnloadFunction()
{
// Needs asp.net session code here
}
</script>
Please let me know Is it possible else any other preferable way of doing.
Try this:
Code-behind:
JavaScript:
If you want more information about
ASP.NET AJAX Page Methods
and how to invoke them viaAJAX
then read Using jQuery to directly call ASP.NET AJAX page methods