views:

46

answers:

2

Hi,

I'm working on an internal web app and I need to get a directory path from the user. I (obviously) can use the asp:FileUpload to get a file but I can't find anything to just get a directory path.

Is there any (preferably simple) way to have a directory-chooser dialog in asp.net? I haven't been able to find any solution on Google or SO yet...

Thanks

+1  A: 

Because you are working on a web app, you are "stuck" with the limitations of what is allowed by the browsers. And I do not believe any of the browsers include a "directory-chooser".

You will probably just have to ask the user to paste the path into a textbox. You can then use some System.IO methods to verify the path is valid when the page is posted.

Jeff Siver
A: 

Did you try basic HTML <input type="file"> ??? Or does this not serve your purpose?

Shankar Ramachandran
Unfortunately, no - it's limited to opening a file(name). There's no option for selecting a directory. There are some hacks based off that input, but none of them are really that good.
Wayne Werner