How to let the user after closing the browser, so that the ASP.net program, after 1 minutes, session expiration

Source: Internet
Author: User

In writing a customer's B/s structure application, suddenly found a trick, do not know whether the MS is a bug, to the relevant research friends
Originally considering writing a class to check the session, session expiration, you must turn to the landing page, you can call the Class page, in a different Web path, so go to the landing page URL are different, each page to call and set the landing page path, so the actual application to give up the idea
Later consider to write a check session failure of the page, by the client every second refresh, you can call in a page, but through the frame embedded in the ASPX when the old request issued, not too good-looking, although the page is hidden.
Then, think about it, with a page, using no refresh technology, to request the expiration session of the page on it, no refresh technology here using the XMLHTTP object, no use of WebService technology.
(due to the customer's BS system, using frame framework, the top-level page is to display the software name, user login information, so the call is placed on the page)
Let's take a look at the code, primarily the client's JavaScript scripting program
<script language= "JavaScript" >
var idx=0;
function Chksession ()
{
var Http = new ActiveXObject ("Microsoft.XMLHTTP");
Http.open ("Get", "chksessionout.aspx", false); Check for pages that fail session
Http.send ();
var str = http.responsetext;//return result after performing ASPX
idx++
document.all ("ConvertResult"). InnerHTML = Str+idx;
if (str== "Notnull")
{
alert (str);
}
Else
{

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.