lothos12345 Posted May 30, 2005 Posted May 30, 2005 I wrote a program in asp.net VB. I want a user to be able to download a selected file from the application to there local harddrive. However, when a user clicks the download button it downloads the file onto the server, The computer that is actually hosting this page. How can I fix this problem. Any help given is greatly appreciated. Quote
Administrators PlausiblyDamp Posted May 30, 2005 Administrators Posted May 30, 2005 Any chance you could post the relevant code? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
lothos12345 Posted May 30, 2005 Author Posted May 30, 2005 Yes Here is the code. Thanks for the help: Private Sub btndwnitm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndwnitm.Click Dim strconn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\emis03\c\webdatabases\cdlib.mdb" Dim objdbconn As New OleDb.OleDbConnection(strconn) objdbconn.Open() Try TextBox5.Text = Environment.UserDomainName Dim clsname As String Dim flesource As String Dim drcodesnips As OleDb.OleDbDataReader Dim cmdsnip As New OleDb.OleDbCommand("SELECT Filename, location FROM codelib WHERE FileName = '" & DropDownList2.SelectedValue.ToString & "'", objdbconn) cmdsnip.CommandType = CommandType.Text drcodesnips = cmdsnip.ExecuteReader While drcodesnips.Read flesource = drcodesnips.Item("location") clsname = drcodesnips.Item("FileName") End While objdbconn.Close() If Directory.Exists("\\" & Environment.UserDomainName & "\c\clsdownloads\") = False Then Directory.CreateDirectory("\\" & Environment.UserDomainName & "\c\clsdownloads\") End If File.Copy(flesource, "\\" & Environment.UserDomainName & "\c\clsdownloads\" & clsname, True) Catch ex As Exception objdbconn.Close() End Try End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.