• 0

[ASP.NET c#] Local Folder Browsing?


Question

Hi Guys,

Started a major porject at my Work Placement of creating a locally hosted asp.net application. One of the things I decided to do on it is, instead of the user actually typing the folder path into a textbox, I would like the users to just click a browse button and then a tree view type browser appear, and then he/she just points the the directory, so that the details that he/she is working on at the moment can be saved locally.

Beacuse I've only just started to learn asp[vbs] classic about a month ago, let alone asp.net[c#], I'm not that clued up on how to do it? can one of you guys please help me out, and explain the steps and objects i need to use.

thanks matt

Link to comment
https://www.neowin.net/forum/topic/645386-aspnet-c-local-folder-browsing/
Share on other sites

5 answers to this question

Recommended Posts

  • 0

The best place to start would be to look into the DirectoryInfo and FileInfo classes in the System.IO namespace.

They give you the ability to enumerate directories and files, find out meta information etc.

The other thing you need to consider is security on your application, so you will also need to look at things like IIS Security, and ASP.NET Security and how they work together.

  • 0

Saving to a local folder from a browser is a privileged operation, so programmatically scanning a client's drive via a browser isn't something I'd ever recommend(you'd need a client technology like ActiveX to do it anyway, and lower security for that control). What you might do is have the user click a "Save" button that would post their work to the server, which would then put the information into a file format and respond it back to the user prompting them to save it somewhere locally via the typical browser 'File Save' dialog. I do something similar when users want to export datagrids to Excel, so I know it is viable.

  • 0

Ah, I didnt read the 'locally' part. azcodemonkey is correct, you would need to leverage some sort of ActiveX control. I wrote one myself for part of an intranet project to allow me to do drag-drop file uploads from the client browser. If it is an internal (read; Intranet-only) application you are writing, I wouldnt see any issues with deploying your control to client machines.

  • 0

ok so I have a local Folder browser set up in a tree view wich itself is in a panel but the problem im getting now is beacuse i have set the panel to auto add scroll bars every time i click to expand a node that say half way down the scroll it just reset back up to top on postback, is there a way to stop the pane from reseting?

  • 0
  TrickierStinky said:
ok so I have a local Folder browser set up in a tree view wich itself is in a panel but the problem im getting now is beacuse i have set the panel to auto add scroll bars every time i click to expand a node that say half way down the scroll it just reset back up to top on postback, is there a way to stop the pane from reseting?

Use AJAX instead of postback.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.