如何在 ASP.NET 中获取路径名?

发布于 2024-09-03 01:24:47 字数 175 浏览 2 评论 0原文

我正在开发一个内部网络应用程序,我需要从用户那里获取目录路径。我(显然)可以使用 asp:FileUpload 来获取文件,但我找不到任何东西来获取目录路径。

有没有任何(最好是简单的)方法可以在 asp.net 中拥有目录选择器对话框?我还没有在 Google 或 SO 上找到任何解决方案...

谢谢

I'm working on an internal web app and I need to get a directory path from the user. I (obviously) can use the asp:FileUpload to get a file but I can't find anything to just get a directory path.

Is there any (preferably simple) way to have a directory-chooser dialog in asp.net? I haven't been able to find any solution on Google or SO yet...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

も让我眼熟你 2024-09-10 01:24:47

由于您正在开发网络应用程序,因此您会“陷入”浏览器允许的限制。我不相信任何浏览器包含“目录选择器”。

您可能只需要要求用户将路径粘贴到文本框中即可。然后,您可以使用一些 System.IO 方法来验证页面发布时的路径是否有效。

Because you are working on a web app, you are "stuck" with the limitations of what is allowed by the browsers. And I do not believe any of the browsers include a "directory-chooser".

You will probably just have to ask the user to paste the path into a textbox. You can then use some System.IO methods to verify the path is valid when the page is posted.

自控 2024-09-10 01:24:47

您是否尝试过基本的 HTML ???或者这不符合您的目的?

Did you try basic HTML <input type="file"> ??? Or does this not serve your purpose?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文