我们可以在Web应用程序中使用system.windows.forms的openfiledialog吗?

编程入门 行业动态 更新时间:2024-10-24 16:26:14
本文介绍了我们可以在Web应用程序中使用system.windows.forms的openfiledialog吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们可以在我的Web应用程序中使用System.Windows.Forms中提供的OpenFileDialog来浏览并获取所选访问数据库文件的完整路径,以便我可以导入该文件的数据。我实际上在本地实现了这个,但不确定它是否可以在现场工作。请建议。 我尝试了什么: 我实际实施了本地成功使用: public string getSelectedfilePath() { string str = string.Empty; System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Title =选择数据库文件; openFileDialog.InitialDirectory = C:\\; openFileDialog.Filter =访问数据库文件(* .mdb,* .accdb)| * .mdb; * .accdb |所有文件(*。*) | *。*; openFileDialog.RestoreDirectory = true; if(openFileDialog.ShowDialog()== System.Windows.Forms.DialogResult.OK) { str = Convert.ToString(openFileDialog.FileName); } return str; } 但不确定它是否可以在现场使用。请建议。

Can we use OpenFileDialog available in System.Windows.Forms in my web application to browse and get full path of selected access database file so that i can import data that file. I actually implemented this locally successfully but not sure whether it will work on live or not. Please suggest. What I have tried: I actually implemented this locally successfully using : public string getSelectedfilePath() { string str = string.Empty; System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Title = "Select database file"; openFileDialog.InitialDirectory = "C:\\"; openFileDialog.Filter = "Access Database files (*.mdb, *.accdb)|*.mdb; *.accdb|All files (*.*)|*.*"; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { str = Convert.ToString(openFileDialog.FileName); } return str; } but not sure whether it will work on live or not. Please suggest.

推荐答案

你不应该在Asp.Net中使用 OpenFileDialog ,而应该去 Asp:FileUpload 控制 file-upload-control / [ ^ ] FileUpload Control [ ^ ] You should not use OpenFileDialog in Asp.Net, instead you should go for Asp:FileUpload Control file-upload-control/[^] FileUpload Control[^]

更多推荐

我们可以在Web应用程序中使用system.windows.forms的openfiledialog吗?

本文发布于:2023-11-16 22:12:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1607680.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:我们可以   应用程序   Web   system   forms

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!