Click here to Skip to main content
15,118,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Help Please!!

I have a c# web application that communicates with a web service, the front-end application takes a unique number(staff number), month, and year from the user and retrieve payslip information from the database, generate a pdf file and dumps the employee information on the pdf file.

The pdf file is password protected, when you open the pdf file the password you provide is compared to one of the fields in the database.

Now my problem is: if you access the application as an administrator you can download payslips for other employees, now I have to add a checkbox which gives the administrator the option to tell the downloaded pdf file whether to require password or not. If the checkbox is checked the pdf file must require password else password must not be required, am stark on this part and I don't know how to go about in adding this functionality. Help!
Updated 14-Aug-13 0:41am
Sushil Mate 14-Aug-13 6:10am
So where you stuck? just ask for password when user clicks on checkbox & at the time of pdf download option create pdf with that password. isn't that simple?
Thando Khumalo 14-Aug-13 6:16am
Code to do that will make it simple, for now nope!
Sushil Mate 14-Aug-13 6:17am
what code? to create password protected PDF? you need to explain more.
Thando Khumalo 14-Aug-13 6:20am
PDF is already password protected, code to tell the application that if the checkbox is checked the PDF must NOT required the password.
Sushil Mate 14-Aug-13 6:27am
application which has check box in it is desktop application & you want to download the pdf from web server through web service? is that you saying?
There must be some code which is making the PDF password protected.
You just need to execute that code, if the checkbox is checked.
Member 9549287 14-Aug-13 13:18pm
what would be the point of putting a checkbox to an application endpoint where the user already has the file. I'd suggest everyone who opens the file enters an appropriate password, else no access. Adding the checkbox beats the whole idea of post-download security...i think.
Silvabolt 14-Aug-13 16:34pm
I think that's exactly what he wants. He wants the admin to be able to generate and download the file without any post download security.
Member 9549287 14-Aug-13 19:24pm
then that'd mean he has to execute at least two different sections of code, or functions . one the deals with normal protected file mode and the other without protection(for admins)?
Silvabolt 14-Aug-13 20:25pm
Precisely, and that's why that checkbox is there to control logic flow. All he has to do is lookup in whatever PDF api he is using to create the file normally without a password. I agree with you though, not the way to go because now there's potential for unprotected copies of the file that's supposed to be protected.
Thando Khumalo 21-Aug-13 3:21am
I fixed it by adding an Enumerator that will pass the security type of the PDF to/from the application and the web service, thanks guys.

Anyway FYI: Am a she not a he :)
Silvabolt 21-Aug-13 9:11am
Sorry about that, glad you got it fixed!

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