ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION

1

Good morning to all, when downloading a pdf and adding a "," (comma) to the header of the pdf mark me the error:

  

ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION

Can you guide me as I can solve this? I need the name of the pdf to have it like this: "Example, Revision.Pdf"

I'm doing it this way:

Dim nameFinal As String = "Ejemplo, Revision.pdf"     
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" & nameFinal)

Use vb.net, and this only happens in Chrome, in IE it works fine

    
asked by PolloKulos 27.11.2018 в 19:30
source

1 answer

0

According to the HTTP standard , you must enclose the name of the file in double quotes. If the name, in turn, quotes, you use the backslash \ as the escape sequence.

The browser should see something like this:

Content-Disposition: attachment; filename="mi archivo con, coma.txt"

Therefore, your code should be something like:

HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=\"" & nameFinal & "\"")
    
answered by 27.11.2018 / 19:40
source