Limit file viewing based on user count - c#

Background
Due to licencing on our Medical PDF Documents, our Doctors are restricted to only have 2-3 of them viewing a PDF document at once.
While we know we could just make a copy of everything and distribute it among everyone, our Doctors feel that they don't want to breach the licence, thus need an effective way to restrict access.
Challenge
While I understand the basic concept of this, I had the idea to use one of two ways:
Have folder access rights on the on the physical PC, to hard-limit the amount of users entering.
Store the information in a database, making the web application restrict the users.
Conclusion
I really don't want to use hard file access rights. This isn't nearly diverse enough for my liking.
I would rather have the application restrict access, because it will then be easier for me to set rights based on users.
My Question
If I did have it database side, I will go about storing the physical PDF's in a folder, then linking them to a page. This page will have a button to open the PDF, that will be enabled/disabled based on the current amount of people who have clicked on it.
When a person clicks 'Close' on the PDF, the application will -1 to the count, allowing a person to access the PDF.
How would I make my application know the PDF has closed?

You should display the pdf in an iframe and provide a "Close" button outside that iframe. This way you will be able to track your open documents' count and act accordingly.

Related

How to capture an event from a UI (web) when I don't have access to the source code

So, here's the use case. I work for Salesforce Marketing Cloud as a technology architect. We have a very robust "Marketing Cloud" app which I don't do any development on. I don't have access to source code/etc. I do have access to the application though, as a user.
Quick 2 sentence overview of the application: big companies like "Company A" utilize our software to be able to send billions of emails (promotional and transactional) to their customers. So, say you get an email from "Company A" telling you of all the great products they offer - that email is sent from our system.
So, the use case: the Marketing Cloud application, for simplicity's sake, is able to create an email from HTML. Basically, the user (myself) can copy/paste HTML into the huge text field, and click Save, and the email code is saved into the back end (SQL Server table). This application does not have any kind of source control to manage the different versions of the "email" that the user decides to create/change/modify.
Now, I have access to develop a customized "whatever" via C#/SSJS that has access to all of the elements in the database that the application writes to. So, if I wanted to grab the latest version of an "email" saved by a user, I can simply write a SQL query to grab this content.
Here's my goal: To create a very simple version control system without getting into the source code of the application. Ambitious, I know. I have all the different pieces of this mapped out in a document, but the one obstacle I'm running into is "how can I capture the 'save' event for when a user clicks 'save' and saves an email"? I believe this is a client side event, but I'm not 100% sure. My initial thought is to write a browser extension, but not knowing exactly what browser extensions have the capability of doing, I'm not sure if this is a good route to take. How can I capture an event from a UI from a web based application when I don't have access to the source code?

How to see my app users are from where?

development of my app has finished, but I want to have general information about my app users.
How can I know they are from which Store/country? store/country-specific downloads
How can I know which languages they are using for focusing on it more.
Will such these informations appear on the dev center or I should have my own server for receiving these information?
Which codes I need, where can I start?
I know I can use device location, but I don't want to use this option
(sorry I couldn't find anything useful by searching)
Update I don't want these informations locally (providing it to the user himself) But I want to know who are my users after sending it to the store.
How can I know they are from which Store/country? store/country-specific downloads
That information is already available in the Store statistics
How can I know which languages they are using for focusing on it more.
Read the Thread.CurrentCulture and Thread.CurrentUICulture , if you want to know what local language/culture the user is user.
The store is bound to the country specified for the users live account.

Set Default Directory for Lotus Notes File Upload Control

I have a lotus notes web form in which computer-illiterate customers will use to attach Excel files and submit them to our company. I am using a Lotus Notes File Upload Control to allow them to do this, however, I need to default this File Upload Control to a certain directory location. I have already created a C# application the customers will be using, which places all of these excel files in a certain directory location, hence the reason I need to focus this File Upload Control. Unfortunately, some of the customers are computer challenged enough to not know how to navigate to these files on their own. Is this possible at all?
I'm assuming the users will be visiting a web page with the File Upload control, yes? If I'm misunderstanding please let me know and I'll delete this answer.
The simple answer is it isn't possible. The problem is that the browser can't know anything about the file structure of the clients that visit the site, so a "default path" property doesn't really make sense. It would likely only work in very specific environments (which is maybe true in your case, but not across the web in general)
I would investigate using the Notes API to have the C# program handle the upload without involving the browser client use of the file upload control. I don't know enough Java to be sure, but perhaps that might also be an option -- basically writing your own custom upload control that only asks the user for the filename.
You may also be seriously underestimating the ability of the users to follow directions. If your page identifies which directory the file will be found in, I expect most users will be able to follow the directions and upload from the correct directory.
So, I'm sure that accomplishing what you want to accomplish is possible in Notes, just not as simply as adding a default directory to the File Upload Control.

Upload items from user computer to a server asp.net

I don't really know how to explain what I want to do.
I will try to explain what I am doing. I built a website in ASP.NET 4 (WebForms) and I want that my brother will be able to click on a button, choose a file from his computer and it will be uploaded to my server.
I have no idea how to do it. It sounds very hard to do and I am really stuck with this for a few days now.
I don't care if it will be with JavaScript, HTML or C#, I just really need it to work.
There's an ASP.NET control made just for that, the FileUpload control. Here's a handy example.
Note that it's notoriously difficult to style if you want to apply CSS and make it elegant, but there are more advanced ways around that. Also, this won't give your web application access to the client's local files or anything like that, it's just a standard file open dialog box for the user to select a file and upload it.
I also highly recommend doing a lot of input checking when accepting files. File type, file size, etc. are all important.
you have 2 options really.. use a traditional fileupload control (from the toolbox) or use the Ajax AsyncFileupload control.
either way it will allow your brother to upload a file from his computer to your server.

Control Printing in ASP.NET Page

I need to create a web application that prints checks. Because of the nature of the program, it needs to be very secure, and each action needs to be logged. I need to be able to generate a check, print a check, allow reprints if needed, etc.
I've got the generation of the checks completed. I've decided to make a PDF (so that i don't get any browser header/footer garbage). What I'd like to do is not even save that PDF to a file but to instead send the data directly to a printer. Basically, I'd like for the user to enter the amount of the check, select which account it's going to be printed for, then click a button that sends the data for that check directly to the printer. I don't even want the user to be able to view the PDF of what's to be printed.
Has anyone done something similar to this in ASP.NET?
Thanks.
[EDIT]
The original question I asked was answered with ActiveX controls. I, however, decided to do it a different way. Instead of printing a PDF, I've decided to create an image of the background of the check. I will then use that image (.jpg), and manipulate it by placing the appropriate text (MICR line, amount, check date, etc.) on it using System.Drawing.Graphics and stored X,Y coordinates and font preferences in my DB. From there, I can use the System.Drawing.Printing namespace to send the new .jpg file to a network printer from the web server, eliminating the need for an activeX control and further tightening security because the new image of the finished check is never saved, and the user never has access to the overlay of the check.
Thanks for your help.
If you look at how postal services tackle this problem, you'll notice that a simple web application won't do. To have control over how and when items are sent to the printer, ActiveX compontents or Java software is used.
[Edit]
Small clarification: I ment that the software has to run on the client-side as opposed to your suggested server-side suggestion.
If you want to go the .NET route, you're down to an ActiveX in Managed C++ or a Click-Once application that is launched from the web (allows more of the .NET language, but can be decompiled and altered).
We have implemented this scenario in a couple of ways. First, we have the traditional PDF solution, where the server generates the PDF print image, returns it to the browser which is then displayed via the PDF plug-in and optionally printed.
Second, we wrote a client-side ActiveX component to handle the print. Pass the input values to a backend web service which uses FOP to format the print into PCL. The PCL is passed back to the ActiveX component who then sends the PCL directly to the users default printer. No PDF required here.
Either way works, but only the second option - which will require you to implement some client-side piece - meets all your requirements.
There isn't really a way to do this. You can only send a document to the user which the user can then send to the printer. There are ways to prompt the print dialogue to pop straight up, but the web would be pretty insecure if you were allowed to control how data was managed on the user's machine.
NKCSS is right that it would require software actually installed on the user's machine. You have done as much as you can by making it a PDF that the user is prompted to print.
If you had the cheque as html, you can used styles to show/hide content just for the printer as discussed in this post: here
There's no way to do this completely securely. Even if you force the PDF to print directly to the user's default printer, that itself could be a PostScript or PDF printer like PDFCreator. So they could still get a viewable PDF in the end.

Categories