• 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.
  • Posts

    • The first link on the github page gives me a very, very red page warning me about phishing........
    • Hey Nick! 👋 No worries at all — you're not alone in this, and it's great you're asking for help. Let me walk you through a simple, step-by-step fix using the tool mentioned on that AOMEI Partition Assistant guide — it really does the trick for many people with this exact issue! ✅ Here’s how to restore your USB back to full 256GB on Windows 11: Download & Install AOMEI Partition Assistant Go to the link you shared: AOMEI Partition Assistant and click the Download Freeware button. Insert your USB stick (Sandisk Ultra 256GB) Make sure it's properly connected. Wait for the system to detect it. Launch AOMEI Partition Assistant Once open, you'll see all your connected drives listed. Locate your USB Drive Look for the one that says something like Disk X – Removable and shows only 3.1GB or so. Right-click on your USB Drive’s Partition Then select Delete Partition → confirm the deletion. Now, right-click on the unallocated space (it should now show full unallocated capacity) Choose Create Partition → format it as FAT32 or exFAT (recommended for larger drives) → click OK. Click “Apply” in the top left corner Then hit Proceed to execute the pending operations. Wait a bit... and boom! 🎉 Your USB should now be restored to its full 256GB capacity!
    • When Facebook bought Beat Saber, they promised exactly this would never happen. Facebook can’t not lie.
    • Depends on what you mean by "this data". Nvidia can show you quite a few of those as well in their performance overlay, and I guess they might've assumed that if anyone wants to see more, they'll just use Afterburner as the de facto standard. As for real framerate vs framegen framerate, I don't think they exactly want you to know, given that their marketing has been strongly focused on hiding the real framerate and pretending the generated one is all that matters...
  • Recent Achievements

    • First Post
      Fuzz_c earned a badge
      First Post
    • First Post
      TIGOSS earned a badge
      First Post
    • Week One Done
      slackerzz earned a badge
      Week One Done
    • Week One Done
      vivetool earned a badge
      Week One Done
    • Reacting Well
      pnajbar earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      713
    2. 2
      ATLien_0
      279
    3. 3
      Michael Scrip
      209
    4. 4
      +FloatingFatMan
      201
    5. 5
      Steven P.
      131
  • Tell a friend

    Love Neowin? Tell a friend!