• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Session Id Problem

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

This is my code.
public class SessionIdServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
HttpSession session = request.getSession();
String id = session.getId();
pw.println("Session Id is : " + id);
System.out.println(id);
}
}
when i am calling this servlet through Internet Explorer that time i am getting one session id and open one more Internet Explorer and run this servlet that time i am getting different Session Id.
But my problem is this is not working like that in Google Crome.

Advanced Thanks.

Regards,
MahiRanga.
 
Ranch Hand
Posts: 81
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats normal.

Thats because not all browser work the same. For example, firefox will always (default) share its active session with other firefox browsers on the same machine. internet explorer doesn't (or didn't, i don't know about the new versions...).

In your case, every time you start internet explorer, all the "browser" sessions on the machine will be separated from each other. And probably, chrome will do the same as firefox, and every started chrome browser on the machine will use the same session (cookies etc...)

of course, this behaviour can be configurated in the configuration of each browser...
reply
    Bookmark Topic Watch Topic
  • New Topic