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

时光怂恿深爱的人放手 提交于 2019-11-27 09:19:58
Aristos

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="/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="application2.aspx" width="0" height="0"></iframe>

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!