Classic ASP: Multiple ASPSESSIONID in cookies

后端 未结 7 1039
悲&欢浪女
悲&欢浪女 2020-12-01 21:07

I have a problem with a classic asp page and I just cannot solve it since 3 days.

The page is working with Sessions - sometimes it happens that the ASPSESSIONID cook

相关标签:
7条回答
  • 2020-12-01 22:04

    I was able to remove those cookies with Javascript.

    Just add next script to the end of login page. This will remove all "ASPSESSIONIDXXXXXXX" cookies before user will login to website:

    <script type="text/javascript">
        //Clear any session cookies
        (function(){
            var cookiesArr = document.cookie.split("; ");
            for (var i = 0; i < cookiesArr.length; i++) {
                var cItem = cookiesArr[i].split("=");
                if (cItem.length > 0 && cItem[0].indexOf("ASPSESSIONID") == 0) {
                    deleteCookie(cItem[0]);
                }
            }
    
            function deleteCookie(name) {
                var expDate = new Date();
                expDate.setTime(expDate.getTime() - 86400000); //-1 day
                var value = "; expires=" + expDate.toGMTString() + ";path=/";
                document.cookie = name + "=" + value;
            }
        })();
    </script>
    
    0 讨论(0)
提交回复
热议问题