Using OpenFileFialog in asp.net web

G

Guest

Hi,

I am creating a web application in asp.net in which I have to show an
openfiledialog box to select the file and display the selected file with its
path in a text box.
I try to solve this problem with the System.Windows.Forms.OpenFileFialog.

I use

Imports System.Windows.Forms

In the sub the code is like...

Dim ofd As OpenFileDialog = New OpenFileDialog

If ofd.ShowDialog() = DialogResult.OK Then
txtPath.Text = ofd.FileName()
End If


I get the following Error.


It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode.Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service application.

What should I do to get the openfiledialog box to appear?
Where can I Specify the ServiceNotification?
Is it possible at all to use the System.Windows.Forms base in a Web form?

I'm not that familiar with asp.net.

Many thanks!
 
E

Elton Wang

Hi Willem,

You can't use Windows component, such as OpenFileDialog,
on web server-side. You may use HtmlInputFile, HTML <input
type= file> element, to select file on client-side.

Hope it helps,

Elton Wang
(e-mail address removed)
 
W

Willem

Thats easy!

Many thanks

Willem
-----Original Message-----
Hi Willem,

You can't use Windows component, such as OpenFileDialog,
on web server-side. You may use HtmlInputFile, HTML <input
type= file> element, to select file on client-side.

Hope it helps,

Elton Wang
(e-mail address removed)

a
service application.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top