Is there any way I can restrict a user to select files from only a particular directory in C#? It should not be allowed to browse other folders.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not possible with the standard .NET wrappers. Reject the path with the FileOk event.
If you can count on your program running on Vista and up then you could consider using the CommonFileDialog class in the Windows API Code Pack. It has a FolderChanging event that can be canceled.