| | |
C#ASP.Net: how to browse the folder list on Server?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
Hi,
I am writing a web app using C# and asp.net. The requirement is that: there is a button "browse" on the webform, when user click it, the folders on the server will be showed. after user select one folder, the fullpath of this folder will be returned. There is no web control could do that. does anybody know how to do it?
Thanks
I am writing a web app using C# and asp.net. The requirement is that: there is a button "browse" on the webform, when user click it, the folders on the server will be showed. after user select one folder, the fullpath of this folder will be returned. There is no web control could do that. does anybody know how to do it?
Thanks
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
On the server side, you'd use Server.MapPath to specify the viritual path to your directory. Then perhaps DirectoryInfo.GetFiles to return a filelist. Iterate through that list to populate whatever Server Control you want to contain that data. A Repeater, perhaps.
Thank you for your reply.
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
You can let the user browse their LOCAL file system, and select a file to upload, via the <input type="file"> HTML tag. There is no equivalent to let a user browse the server's file system.
I understood your question. My answer was meant to show you that you'll have to code this yourself, and some of the .NET classes you could use to do so.
Left unstated is what the user would do with a file they selected. To know what they selected, you'll have to generate a PostBack / form submit, and then presumably serve them back the selected file via a Response.Redirect() to that file.
I understood your question. My answer was meant to show you that you'll have to code this yourself, and some of the .NET classes you could use to do so.
Left unstated is what the user would do with a file they selected. To know what they selected, you'll have to generate a PostBack / form submit, and then presumably serve them back the selected file via a Response.Redirect() to that file.
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by tgreer
You can let the user browse their LOCAL file system, and select a file to upload, via the <input type="file"> HTML tag. There is no equivalent to let a user browse the server's file system.
I understood your question. My answer was meant to show you that you'll have to code this yourself, and some of the .NET classes you could use to do so.
Left unstated is what the user would do with a file they selected. To know what they selected, you'll have to generate a PostBack / form submit, and then presumably serve them back the selected file via a Response.Redirect() to that file.
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
No, I don't think I'll post any "real code". You're undertaking a sizable project, and that's a bit beyond the scope of coding for a forum example.
Quite simply, you have to duplicate the entire "open file dialog" box of the Win32 API. Such a thing just doesn't exist on the web. Web servers aren't built for this task. You'll have to code the entire graphic form, somehow using Web Server Controls... then populate the controls with the directory and file information. Then code all the events for when a user clicks a file or folder, each of which will require a server round-trip.
It's a big, big project. I think you'd be much better off making your project conform to the way the web works: give your users a list of hyperlinks.
Quite simply, you have to duplicate the entire "open file dialog" box of the Win32 API. Such a thing just doesn't exist on the web. Web servers aren't built for this task. You'll have to code the entire graphic form, somehow using Web Server Controls... then populate the controls with the directory and file information. Then code all the events for when a user clicks a file or folder, each of which will require a server round-trip.
It's a big, big project. I think you'd be much better off making your project conform to the way the web works: give your users a list of hyperlinks.
![]() |
Similar Threads
- ASP.NET project (ASP.NET)
- Senior C#.Net Software Engineer - Oxfordshire - ASP. Net / SQL Server (Web Development Job Offers)
- Difference between asp & asp.net (ASP.NET)
- Auto Mail in ASP.NET (ASP.NET)
- SQL Server, Images and DataGrid in ASP.NET (ASP.NET)
- Error creating new ASP.Net project (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: Problem with sql reader
- Next Thread: Azman Help
| Thread Tools | Search this Thread |
.net 2007 access activedirectory algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset date datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum eventcloseformc# excel file foreach form format forms ftp function gdi+ image index index-error input install java label list listbox listener listview load mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remoting richtextbox security server setup sleep socket sql statistics stream string table text textbox thread time timer totaldays update user usercontrol validation visual visualstudio webbrowser windows winforms wpf xml






