how to have different Sessions for each tab on IE8 - asp.net-mvc-3

I have a intranet application, Users are validated against a ACtive directory.
I m using session to store data. using InProc Session mode.
when the user open 2 tabs does something onthe tab1 and goes to 2nd tab to do someoperation but im seeing the data in sesssion for teh previous results so this is giving some strange behaviour and the user is not seeing wha ti supposed to seee.
i have around 12 variable in session to keep data but all this messes up when the user opens multiple tabs and confuses the user.
is there a way to do it using c# or javascript to have each tab or window its own session
Help me out with
if possible could you provide me some code samples to achieve this.

you cannot have different sessions in different tabs, because session is domain specific, but you can either change your logic and store variables in FORMs - preferable way, or you can have multiple domains, as it is intranet - you can configure DNS to point all *.intranet.domain to your site, during first call you can redirect user to RANDOM.intranet.domain and put sessions cookie for this domain only, then next problem will be detecting different tabs - use search, there are several approaches, so in new tab you can redirect user to new RANDOM2.intranet.doamin url

Related

Oracle Apex login Twice on the Same App, Machine and Broswer

I don't know if this is possible but. Is it possible to login twice on the same user on the same app in the same browser.
Reason for this is to allow users visibly 2 full pages at once without have to flick between pages.
This would be displayed over 2 screens.
I know you can use IE for one page and say Chrome for the other. This gets around the cookie/session issues. Or I could create multi users user1-1 & user1-2 for example but that's not a good option to use.

parameters lost when open new window in C#

I develop a site where certain pages a user can only access when he is logged in.
For certain requests I would be better when I open new window. Mostly I use the session to store data including the user data.
To open a new window I use:
ScriptManager.RegisterStartupScript(this, typeof(string), "OpenWindow",
"window.open( '~/smsftd1', null,'height=400,width=600, status=yes,
toolbar=no, menubar=no,location=no' );", true);
It opens the window and it looks how I want it and how it should behave. The only downside is that all data I have saved with the session variables are gone.
If I redirect in the same pages or even open a new tab it works fine and all session variables are available.
When I search for the issue it was pointed out it is an IE issue (older versions). I changed the settings in the IE browser settings but it did not help.
The main issue is that I loose the authorisation the user made.
At the moment I removed to opening of a new window and just redirect.
If someone has done this I wish to know so I can organise a better flow.
The only option I could think of is storing data in a cookie instead of the session.
Any feedback please?
There is no direct answer, but you can check with fiddler or trash tool in firefox.
Please increase your session timeout.
Also check in global.aspx, that there is no event call when new window open.
The best thing is fiddler to check where you all history show about what are the cookie/session variable, link to redirect etc.
Please this link before doing anything.
After a few window.open calls my ASP.NET session times out
http://bytes.com/topic/asp-net/answers/287080-session-variable-window-open
Keeping ASP.NET Session Open / Alive
Add in web.config and try(reference from above link)
"<httpHandlers>
<add verb="GET,HEAD" path="SessionHeartbeat.ashx" validate="false" type="SessionHeartbeatHttpHandler"/></httpHandlers>"

How do I share data across multiple browser tab or windows?

I m currently building a facebook style notification system for my site.
I m using long polling. So, the server sends data if its available and closes the connection.
Now the problem i m facing is that, i want it to share across all open tabs or windows of that browser.
I m using a cookie to detect if a tab is already executing the ajax call, so other tabs will not execute it until the operation of the first tab is complete.
Now what i want is, to have an effective way, so that i can show the data across all open tabs in the form or a small fb style popup box.
The goal is if the last active ajax call has some data, then a small popup box will show up on all open browser tab or windows.
As, a theory i may be able to do it via cookie, but i want to know if there is some better way to do that.
Thanks,
Anjan
Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie.
If you're ok with the cookie idea, follow these examples:
For client side access
For PHP access
For NodeJS

Is it possible to maintain different sessions (users) in different window tabs using Spring 2.5?

We have a requirement where support for different users in different tabs of a browser window. How can we achieve this in Spring 2.5? The application is based on Users, where users will have their own agents and articles. An internal user should be able to login to different user accounts in different tabs at same time and manipulate their data. Any help is much appreciated.
A browser's cookie store does not distinguish between different windows or tabs when deciding what cookies to send. So a cookie based approach won't help.
My suggestion for an alternative would be to have a hidden "userName" parameter that is passed back and forth as a URL query parameter for all requests from a given tab or window. You could finesse the setting of the parameter in browser requests by using some Javascript to add a hidden parameter to each of the HTML forms in the page just loaded. The parameter value would be snarffed from the query string of the current page URL. You'd just need to make sure that all pages included stuff in the header to load the JS and run it when the page load completed.
Generally speaking, no, because all of the tabs within the browser window share the same cookies.
One way to do it would be use multiple domain names all pointing at the same app. Each domain name would have its own set of cookies. You would need to have some way of switching to a new domain name after you open a new tab.
How about, have a set of bookmark toolbar bookmarks, each corresponding to a different domain name. Control-click on the bookmark and it opens in a new tab. You could provide the users links in your navigation to the different domains that they can drag onto their toolbar.
Depending on what browsers your users are using you could get even slicker - in some browsers Javascript window.open() opens a new tab. You could have the JS compute the new domain name before the window.open().

How to best handle user state when multiple browser windows share same session?

I have a web application (Java, Websphere, JSP) which allows co-workers to register visitors to various company exhibitions. A user object is stored in the session which records the currently selected exhibition and this is used when entering the details of new visitors.
One user has decided to open a second browser window which seems to share the same session. The user browses to an other exhibition in the second window. This changes the state of the currently selected exhibition. Back in the first window a menu item is clicked: 'List visitors'. The resulting list is a list of visitors to the exhibition selected in the second window.
I know that I could add the exhibition id to every form on every page but my actual scenario is more complicated that the one I have described.
What is your stategy for dealing with this kind of problem?
My first guess would be you can avoid the problem by keeping (or perhaps only identifying) view state in the URL and not the session.

Resources