Right now we use the exception message to trigger a message dialog when the excel file is password protected, but I was wondering if there is a better way to handle this. We just want to check if the supplied excel file is password protected, not open it, and trigger a warning message. We use C# Asp.net MVC 4. Any help would be appreciated.
Asked
Active
Viewed 252 times
2
-
not a way that I am aware of without actually opening the file... – May 13 '14 at 11:04
-
I also think that it is impossible to detect password protection trom the outside of a file. However, you could try open the file with JavaScript before uploading it to your server. You save resources on your server and from a legal point of view you are not the one opening the file. Is there a reason Why you don't want to open the file to check for the password? – Jan Rothkegel Jun 04 '14 at 13:07
-
By "not open it", I mean I don't want to supply a password to the file and open it, although it's perfectly fine if I do that. We have a web application in which user uploads an excel file, the application processes it, and saves the data to a database. But as an application guideline, a user is not allowed to upload a password protected file. So when a user tries to upload a password protected file, I want to show an error dialog, saying the file you're uploading is password protected, and cancel the file upload process. – Rahul Jun 27 '14 at 11:05