Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Is there a way to download a file without user interface? ( no dialog box )

Posted on 2006-07-20
5
Medium Priority
?
307 Views
Last Modified: 2008-01-09
Hi everyone,

My VB .net (framework 1.1) application has an option to download files from our ftp site(outside our domain). The files downloaded are suppose to be placed in one of our servers(not the user machine). But I don't want the user to choose the path because for sure the files will be downloaded to the wrong place and my app won't be able to find it.

Is there a way to download the files to a specific place without having the user to choose the path?

thank you,
Abovet

 
0
Comment
Question by:adrianabovet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
Dbergert earned 750 total points
ID: 17149398
you probably need to state or exaplain how the dialog box is created or how you are downloading the files...

programatically you should be able to code the path in the applicaiton...
0
 

Author Comment

by:adrianabovet
ID: 17149460
Sure... This is the code that I am using....


       
            Try
                Dim filedesc As String = CType(e.Item.FindControl("File"), LinkButton).Text  '(This is the full path of the file)
                Dim filetype as string
             
                'get file name
                Dim fullPath As String = filedesc
                Dim fi As New System.IO.FileInfo(fullPath)
                filename = fi.Name

                If File.Exists(filedesc) Then
                    Response.Clear()
                    ' Set filestream for appropriate file type
                    FileType = LCase(Right(filedesc, 4))
                    Select Case FileType
                        Case ".asf"
                            Response.ContentType = "video/x-ms-asf"
                        Case ".avi"
                            Response.ContentType = "video/avi"
                        Case ".doc"
                            Response.ContentType = "application/msword"
                        Case ".zip"
                            Response.ContentType = "application/zip"
                        Case ".xls"
                            Response.ContentType = "application/vnd.ms-excel"
                        Case ".gif"
                            Response.ContentType = "image/gif"
                        Case ".jpg", "jpeg"
                            Response.ContentType = "image/jpeg"
                        Case ".wav"
                            Response.ContentType = "audio/wav"
                        Case ".mp3"
                            Response.ContentType = "audio/mpeg3"
                        Case ".mpg", "mpeg"
                            Response.ContentType = "video/mpeg"
                        Case ".rtf"
                            Response.ContentType = "application/rtf"
                        Case ".htm", "html"
                            Response.ContentType = "text/html"
                        Case ".asp"
                            Response.ContentType = "text/asp"
                        Case ".pdf"
                            Response.ContentType = "application/pdf"
                        Case ".ppt"
                            Response.ContentType = "application/mspowerpoint"
                        Case Else
                            'Handle All Other Files
                            Response.ContentType = "application/octet-stream"
                    End Select

                    Response.AddHeader("Content-Disposition", _
                    "attachment; filename=" & filename)
                    Response.Flush()
                    Response.WriteFile(filedesc)
                End If
            Catch ex As Exception
                lblerrormsg.Text = ex.Message.ToString()
            End Try
     
0
 
LVL 5

Expert Comment

by:Dbergert
ID: 17149497
IF you have a limited number of file locations you could "Name" them, and then in the code associate the Path ot the Name...  A User would pick where they want the file to go, but would not need to worry about the path ?  you cou

Select Case fullPath
                        Case "Server"
                            Path  = "C:\somplace\somefile"
                        Case "Server_2"
                            Path  = "\\SERVERNAME\\UNC\PATH"
        End Select

Am I understanding you correctly ?
0
 

Author Comment

by:adrianabovet
ID: 17149588
Well....the problem is not choosing which files are going to be downloaded but not allowing the user to choose the path where the files are going to be downloaded to.

After the response.writefile(xxxx) line is executed the download dialog box comes up asking the user if he wants to "open" "save" or "cancel". This is what I would like to avoid, because I know exactly where save these files.
0
 
LVL 1

Expert Comment

by:Error113
ID: 17150364
What you are refering to is called a browser exploit. MOST browser exploits are illegal(i assume). there are ways around it.  
Let me get the scenario correctly though.

You want the file on your SERVER to automaticalyl download to a directory on the USERS computer (suck as c:\directory\) and you want to avoid the dialog screen which asks for a location, (and also allows you to cancel).


Scenario 1.  You know the people who are coming to this site.
Use an Active X control and tell them to accept it. you can write a simple active X control (or pay someone to) that saves a file to a set location on the local computer
(I have done this, make sure to DELETE the file before trying to overwrite it, otherwise it will not work. )

Scenario 2. Your just tricking random fools into downloading a file without knowing it.

Learn more about exploits here. But to be honest if your asking this question, you dont have what its take to do it, AND get away with it.

http://www.governmentsecurity.org/archive/t1781.html

Different Exploits work on different browsers and services. read the legal part, which will tell you that it is illegal to do these things.

0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question