2

In a project I'm working on (ASP .Net 3.5 web forms), there is a requirement to restrict the user to work in only 1 window/tab at time. I found this post detailing a solution: http://www.codeproject.com/KB/aspnet/MultipleTabWindows.aspx

However, in one of the pages of my project there is a requirement to open a private (related to the logged in user) pdf document in a new window. The way I'm doing it is by building a request to a page inside of my project and, from that page, stream the pdf document. So, the url of my document looks something like: http://localhost:4087/PdfPage.aspx?type=1&id=2

Q: is there a way to bypass the "single window" rule for only the pdf page or should I say "No, the only way is by opening the pdf in the same window"?

Thanks in advance

2
  • You could have the PDF download instead of open in the browser. Most OSes will then open it in the default application. Dec 21, 2011 at 22:29
  • Funny guy. No, it's no my requirement. It's a requirement from our clients. They say it's a BEST PRACTICE for secure sites. They say banks do it for all their sites throughout America. So, don't -1 me, -1 our client please Dec 21, 2011 at 22:35

1 Answer 1

1

When I used the example I put the code on the master page that most of the pages use. Some of the exceptions are links to pdf documents and the login page and assorted error pages.

If that doesn't work you could add logic to the javascript block to look at window.location to allow certain pages through.

Someone needs to say it, implementing any kind of security through javascript is inherently weak. All this really gets you is a short cut to state-management.

Under ideal conditions you should work with your client to make them receptive to the advice their IT department has to offer, instead of them mandating implementation whatever feature they see someone else use. Easier said than done, I know.

Best of luck!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.