• 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

    • I suspect that this was also due to a nice juicy bribe from the Chinese. They know how to pay to play...
    • You can get RAID if it is connected to a TerraMaster NAS (TOS 6). In that case this device is interesting if you want to expand your existing TerraMaster NAS setup. For example you could get a cheap 2- or 4-bay HDD model (with at least USB 3.2 10Gbps port), and then add this for a low power storage expansion.
    • Microsoft announces multi-year partnership with AMD for future of Xbox consoles and hardware by Pulasthi Ariyasinghe The Xbox Games Showcase was earlier this month with its own hardware announcement, but Microsoft had kept a major partnership under wraps for now. Today, it revealed that it has established a "strategic multi-year partnership with AMD" to develop its next-generation Xbox consoles and other devices. In a video uploaded to the Xbox social channels, Xbox president Sarah Bond announced the partnership with AMD. Remember that Microsoft's Xbox Series X|S consoles and the previous Xbox One lineup already tout AMD silicon inside, so the continued partnership isn't a big surprise. "Together with AMD we're advancing the state of art in gaming silicon to deliver the next generation of graphics innovation to unlock a deeper level of visual quality and immersive gameplay and player experiences enhanced with the power of AI, all while maintaining compatibility with your existing library of Xbox games," said Bond in the video promoting the partnership. The two Xbox Ally Windows gaming handhelds that were announced earlier this month also come with AMD internals, offering handheld gaming experiences with a unique, lightweight version of bloat-free Windows 11. What was also interesting were the few hints that were dropped today regarding the focus of the Xbox brand going forward. "This is all about building you a gaming platform that's always with you, so you can play the games you want across devices anywhere you want, delivering you an Xbox experience not locked to a single store or tied to one device," added Bond. It was also confirmed that the next generation of Xbox devices will continue to offer backward compatibility, letting players keep their existing libraries when moving forward. Finishing off the video, Bond confirmed that the Xbox team is now working on Windows to make it the "number one platform for gaming," perhaps alluding to moving away from being focused on home consoles.
    • Kudos to the happy talented people who created that happy trailer. PS It's gorgeous!
    • Maybe the site will get out of dabbing into Identity Politics.
  • Recent Achievements

    • Reacting Well
      Cole Multipass earned a badge
      Reacting Well
    • Reacting Well
      JLP earned a badge
      Reacting Well
    • Week One Done
      Rhydderch earned a badge
      Week One Done
    • Experienced
      dismuter went up a rank
      Experienced
    • One Month Later
      mevinyavin earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      697
    2. 2
      ATLien_0
      275
    3. 3
      Michael Scrip
      218
    4. 4
      +FloatingFatMan
      188
    5. 5
      Steven P.
      146
  • Tell a friend

    Love Neowin? Tell a friend!