I want to know how to change user folder using GeckoFX where its save cookies, user data, etc. Thanks.
GeckoPreferences.User
I don't know if there is a way to change it.
Related
I have an application that displays password protected PDFs using iTextSharp.
pdfCopy.SetEncryption(true, "Secretinfo", "Secretinfo", 0);
If the user saves the PDF, the saved copy of the PDF is password protected. Which is great. The problem is it also prompts for password before displaying the PDF on the browser. Which isn't good.
So I'm thinking maybe it's possible to supply the password using javascript just to display it on the browser. It's bad practice but I don't see that I have any other choice. I'm no good at JavaScript. Maybe someone here can help me?
But hey if you have another idea of how to best approach my problem, please do tell!
Here's what I need to happen:
Display the PDF on the browser without it prompting for password. But I need the saved copy to be password protected. No edit, print or copy. Not even view. Unless the user supplies the password.
I am working on a form on a page that uses an asp:FileUpload to allow users to upload files to a server. I'm new to ASP and am using C# for my code-behind. The plan is to have the user "attach" files one at a time, adding them to an asp:listbox. Finally when the form is submitted the files in the listbox get saved to the server.
While it seems pretty easy to save files from the FileUpload by using
myFileUpload.SaveAs("path");
I am running into some difficulty figuring out how to keep track of the files independent of the FileUpload. I can get the file names really easily using
Path.GetFileName(myFileUpload.PostedFile.FileName);
but really I need to have some way of keeping track of more than just the names. My first thought was maybe to use a temporary folder of some sort, but the files are going to potentially be pretty large so I don't want to do that because saving might take a while.
How can I keep the file around so that I can save it on the server later independent of the FileUpload?
Rather than using a ListBox I would use actual <asp:FileUpload> controls so you can have access to all of the methods for that control - such as Save Etc.
You can put a bunch of these on your page and simply hide all but the first one. Then have a button to say "Add Another" - then with the click of this button show the next <asp:FileUpload> control - JQuery would be a nice choice to show the next <asp:FileUpload> that is currently hidden.
Then in your postback you can loop through all of your <asp:FileUpload> controls and if it HasFile - which is a property on the control - then perform your saving etc.
Save them into a temporary folder if needed - perhaps renaming the file with a GUID and store this list of GUID's in the users Session so you can grab those when needed.
Once you call SaveAs, you're saving the file. The base FileUpload control won't allow you to cache the file somewhere without actually uploading it to the server first. If you are looking to upload multiple files without uploading until the end, you may need to look into dynamically generating FileUpload controls (as many as the user wants). That way they can select the files to upload one at a time, then hit an "Upload" button at the end.
It's a little clunky to do it that way, though. I'd look for some third-party multiple upload controls. I've used PLUpload in the past.
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.
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.
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.