I have a ASP Page that allow the users to Download a File @ the Click of the button the File Download Dialog Box will pop up on the Scream ,on the download dialog Box are 4 buttons namely Open ,Save,Cancel and More Info :mrgreen: ,How do I disable any Button on the Dialog box let say the Save button?????? :mrgreen:

Dani AI

Generated

Short answer: browser and OS control the download dialog — there is no reliable server-side way to disable individual buttons like Save or Open. That is what pointed out, and correctly added that the only real exception is that the Open option may be omitted if the client OS has no registered application for that MIME/type.

Practical alternatives and reliable server-side controls: send the right HTTP headers and stream the file from an ASP handler so the server controls how the browser treats the payload. Typical goals are (a) force download (Content-Disposition: attachment), or (b) allow inline rendering (Content-Disposition: inline) and set a correct Content-Type. Serving files through an ASP endpoint (file stored outside the webroot) also enables authentication, expiring links, logging, and consistent headers. Note that modern browsers (Chrome, Firefox, Edge) and user settings can change the UX (download shelf, automatic save, “always open” flags); those client choices cannot be overridden by the server. ’s ASP.NET example in the thread is a useful reference for the headers approach in ASP.NET; classic-ASP needs a slightly different streaming method.

Minimal classic-ASP pattern (binary streaming, use as a template):

<%
' classic ASP: force download using ADODB.Stream
Response.Clear
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=""MyFile.pdf"""
Response.AddHeader "Content-Length", CStr(fileSize)

Set stm = Server.CreateObject("ADODB.Stream")
stm.Type = 1
stm.Open
stm.LoadFromFile filePath
Response.BinaryWrite stm.Read
stm.Close
Set stm = Nothing
Response.End
%>

Troubleshooting notes: verify file existence and correct Content-Type, avoid Response.Write for binary data, set Content-Length where possible, and use chunked reads for very large files. If an "Open" button is missing, check client-side file associations — that behavior is on the client, not the server.

Recommended Answers

All 9 Replies

You can not disable the boxes. They are part of the browser and there is nothing you can do to disable them.

No code in the world can disable them.

Two comments.

First, I haven't seen the "More" button you mention (running IE 7, XP Professional SP2).

Second, scouring the Web brought me no idea of how to control the buttons individually.

However, regarding Open, I noticed that a client OS that was not configured to recognize the file type being downloaded would not know which environment to open, and therefore would not display the "Open" button--for example, the client displayed the download-file name in the File Download Box but Windows did not seem to recognize .doc files, therefore Windows didn't open the file in Word and did not display the Open button, only Save and Cancel.

Also, I did find some C# code that purported to suppress the Open. VB.NET seemed to recognize the code without changes except dropping the final semicolon. It didn't do the job in my app that the author claimed it did in his, but here's the code:

Response.Cache.SetCacheability (HttpCacheability.NoCache);

So, to second what Drew said--there's no way to control the buttons individually. But there's the exception that Open will appear, or not appear, depending on whether the browser recognizes your file type.

Hi
Can you please give me the codes of the "download Dialogue box' I need to put in on my page so that the user can download a pdf file.

Hi there,
I too am looking for the codes of the download dialog box. Did you get a reply or and answer?

i am too looking for the code for file downloading dialog box asp.net using vb.
if any one could help me with it.
thank you

how i can put download link for image,flash file,other file in my webpage that can other download it ?

how i can put download link for image,flash file,other file in my webpage that can other download it ?

Try

Dim FilePath As String = Server.MaPath(Folder+filename)
           Dim FileName As System.IO.FileInfo = New System.IO.FileInfo(FilePath & "\" & lblFileName.Text)
            '  If FileName.Exists Then
            Response.Clear()
            Response.AddHeader("Content-Disposition", "attachment; filename=" & FileName.Name)
            Response.AddHeader("Content-Length", FileName.Length.ToString())
            Response.ContentType = ReturnExtension(FileName.Extension.ToLower()) '"image/jpeg"
            Response.WriteFile(FileName.FullName)
            Response.End()

            'Else
            'Response.Write("This file does not exist.")


            'End If
        Catch ex As Exception
            lblMsg.Text = ex.Message
        End Try
' Sub for extension
Public Function ReturnExtension(ByVal fileExtentsion As String) As String
        Select Case fileExtentsion
            Case ".html", ".htm"
                Return "text/HTML"
            Case ".txt"
                Return "text/plain"
            Case ".doc"
                Return "application/ms-word"
            Case ".tiff"
            Case ".tif"
                Return "image/tiff"
            Case ".asf"
                Return "video/x-ms-asf"
            Case ".avi"
                Return "video/avi"
            Case ".zip"
                Return "application/zip"
            Case ".xls"
            Case ".csv"
                Return "application/vnd.ms-excel"
            Case ".gif"
                Return "image/gif"
            Case ".jpg"
            Case "jpeg"
                Return "image/jpeg"
            Case ".bmp"
                Return "image/bmp"
            Case ".wav"
                Return "audio/wav"
            Case ".mp3"
                Return "audio/mpeg3"
            Case ".mpg"
            Case "mpeg"
                Return "video/mpeg"
            Case ".rtf"
                Return "application/rtf"
            Case ".asp"
                Return "text/asp"
            Case ".pdf"
                Return "application/pdf"
            Case ".fdf"
                Return "application/vnd.fdf"
            Case ".ppt"
                Return "application/mspowerpoint"
            Case ".dwg"
                Return "image/vnd.dwg"
            Case ".msg"
                Return "application/msoutlook"
            Case ".xml"
            Case ".sdxl"
                Return "application/xml"
            Case ".xdp"
                Return "application/vnd.adobe.xdp+xml"
            Case Else
                Return "application/octet-stream"
        End Select


    End Function
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.