Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2005, 01:14 PM
Authorized User
 
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to someshtrivedi
Default Multiple Browser Problem

When I open two browsers(both instance of browser run the same application) on my computer and log in first as one person and then log into the second one as a different person. The first browser becomes the second user also.
Normally web applications dont behave this way, can u please suggest me whats going wrong and possibly some solution for it.

Somu.

 
Old January 17th, 2005, 03:49 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

*Most* web applications work this way. When you open a new window using Ctrl+N or File | New Window, both browser windows will share the same cookie collection (and other settings).

Since authentication is often done with cookies, both browser windows will submit the same cookie's so effectively you become the other user in the other browser window.

To avoid this, start a new instance of a browser, instead of opening a new window from the current one.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 18th, 2005, 03:51 AM
Authorized User
 
Join Date: Sep 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to someshtrivedi
Default

Thanks Imar
Is there anyway to solve the above problem ???

 
Old January 19th, 2005, 02:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Probably not.

This is the way the Web was built. A connection between a browser and a Web server is stateless. This means that as soon has you have been served the page you requested the Web server forgets about you. To enable a Web site to track those "anonymous" users / connections, cookies can be used. Whenever you request a page, the browser also submits the cookie collection that falls within the scope of your request. So, both browser windows will submit the same cookies, making it appear they are the same user from (quite possibly) the same browser window. The fact that your end user is actually using two windows is not visible to the Web server.

Maybe this can be done with client side JavaScript, but I am not even sure how to do it, or wether it's possible at all.

Why is this so important to you?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Falling Away With You by Muse (Track 6 from the album: Absolution) What's This?
 
Old February 28th, 2005, 12:09 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Keep in mind also that you will never be able to control how the user opens a new window except when you are using client side script. And in that case, the browser will be opened as a sibling/child window and will most likely share cookies. Different browsers will handle this differently however.

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
PROBLEM WITH XML DISPLAY IN BROWSER jceaser1254 XML 7 April 21st, 2007 03:45 AM
Problem in using Browser in Winforms jay69 C# 0 December 5th, 2006 05:49 AM
Problem with xml and layers in different Browser. diptanjan XML 0 March 9th, 2006 09:40 AM
Multiple browser instances Dilip Nagle Classic ASP Basics 1 September 29th, 2005 10:33 PM
Inherits Problem In Browser (Urgent) helga@trisyn.co.za ASP.NET 1.0 and 1.1 Basics 1 September 27th, 2005 09:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.