The thing is, if you deploy the application on a web server and try to access it on client, It will not work and your page will hang waiting for an input.
Currently, your client and server both are on the same machine and hence you can see the dialog box(but that dialog is actully opening on server side).
You need to have a custom control which will open on client side. Check the link below:
Directory Browsing in ASP.Net 2.0[
^]