alsoumhi 0 Junior Poster in Training

Hi experts, I have a click button called log off , here once a user clicks it , task goes to logout servlet to end current user session . below is my code , I don't know why it works fine with mozilla firefox and google chrom but not working with internet explorer. please help me I did many tries till got headache

response.setHeader("Cache-Control","no-store"); //HTTP 1.1
            response.setHeader("Pragma","no-cache"); //HTTP 1.0
            response.setDateHeader ("Expires", 0); 

            HttpSession httpSession = request.getSession();  
            httpSession.setAttribute("validUser",null); 
            httpSession.invalidate(); 

            HttpSession session = request.getSession(false);    
            if(session == null)
                response.sendRedirect("/index.jsp");
            else
            response.sendRedirect("http://www.google.com");//just to test

here it goes fine to my index, but if I logged in again, I should enter a new session , but unfortunately this not happened in explorer , works fine with mozilla , and chroom.

I have also done in my index.jsp the check like below:

<%
     if(session!=null){
              session.setAttribute("validUser",null);
             session.invalidate();

%>

just to erase whatever previous session . But why session exist on same page !!!!!!!!!!!!!! only in explorer , it makes me open new explorer for new user and that is what I don't want !!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.