Keeping a related ASP.NET application’s session alive from another ASP.NET application

Make a page on each site, thats reload a small image time to time.
Now instead of the image, you load a handler that return the image.

<img id="keepAliveIMG" width="1" height="1" src="https://stackoverflow.com/img/ui/spacer.gif?" alt="" /> 

<script language="javascript" type="text/javascript"> 
    var myImg = document.getElementById("keepAliveIMG");

    if (myImg){
        window.setInterval(function(){
              myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());
            }, 6000);
    }   
</script> 

Then use an iframe inside your applications that load the other application page with the image reload. Or in general use an iframe, because with iframe you can keep the cookies updates from 2 diferent sites.

<iframe src="https://stackoverflow.com/questions/5642682/application2.aspx" width="0" height="0"></iframe>

Related : Reset session timeout without doing postback in ASP.Net

Leave a Comment