Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,
we needed to do a security improvement on certain pages to prevent them from being opened on multiple tabs. The application would need to allow the user to open a new tab and the first tab that was opened to show an invalid access message. The outcome would be that a user can have a page opened only in one tab of a browser.
i have used to developing in ASP.NET WITH C#,

so kindly drop the solution.
its very helpfull.
thanks in advance

with regards,
stellus.
Posted
Comments
PIEBALDconsult 24-Oct-14 10:22am    
I strongly dislike apps that do that. It's user-hostile, so you'd better have a really good reason to do it.
The one app I use that does that, simply responds to a right-click with a dialog saying "please don't do that" -- have you tried that?

Hi,

Just to clarify, you have one page opened by a user - and you want to restrict that user (or any other user for that matter) open up the same page in another Tab or Window?

If what i said is that case, you would have to control this on the server side.

For example for a single user: You could store a session variable Session["currentUrl"] or Session["currentRecordID"] so that when you load a page you can set this and check this.

If the ["currentUrl"] or ["currentRecordID"] exists already, then you could show a message to the user.

If is a multiple users scenario, the you would need to store these variables in a database somewhere.

Remmember, you would have to release the lock on the page or record when you navigate away from it.

Hope this helps.

J Tallon
 
Share this answer
 
As pointed out this is difficult to do in a user-friendly way. It will be difficult to always know when the user leaves the page to "unlock" it.

To ensure that the same page is not shown at the same time in the same browser session (different tabs or different windows) you might have to have some kind of active callback script that periodically ask the server whether it is the latest requested version of the page, and block the input and deny feedback if it is not.

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900