c# - On closing browser tag delete particular data from sql database -


i using cookies, like...

httpcookie id = new httpcookie("id"); id.value = "2" response.cookies.add(id); 

and using cookies in table

unique    cookies    productid 1          2          1 2          2          3 3          2          4 4          1          1 5          1          2 6          2          1 

now want process on browser close data stored in table having cookies value 2 in column(cookies) deleted.

i mean after close of browser tag

my table should seen as

unique    cookies    productid 4          1          1 5          1          2 

please me

this might work. use javascript/jquery see if browser closing

<script type="text/javascript"> $(function () {     $(window).unload(function () {         //run ajax webmethod call here     }); }); </script> 

if above doesn't work in body

<body onbeforeunload="closefunction();"> 

then create method called closefunction , run ajax webmethod there:

function closefunction() { //run ajax webmethod call here } 

see this link on how ajax webmethod call


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -