I need code that will allow the user to do the following:

1. Select a browse button and choose the folder they want to save a file once the exe file at the end of the program runs

2. Display the folder location the user selected in the textbox next to it

Basically this is a save dialog box but since this is a web application and not a web form I can not use the dialog boxes.

Here is the code I have so far, I am thinking its not right so please help me with this!

Protected Sub Browse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Browse.Click

        Dim FilePath As String = ("C:\Users\Public\Documents")
        Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(FilePath)

        If targetFile.Exists Then

            Response.AddHeader("Content-Disposition", "attachment; filename=" + targetFile.Name)
            Response.AddHeader("Content-Length", targetFile.Length.ToString)
            Response.ContentType = "application/octet-stream"

        End If

    End Sub

Thank you

What type of control is your browse?

If it is of type "File" (in HTML), you will get a dialog box

    <form id="form1" runat="server">
    <input id="fileIn" type="file" name="fileIn" runat="server"/>

...but are you trying to reference on the on the server or the client machine?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.