• Register
0 votes
253 views

Problem :

I encountered below error while I was trying to export to pdf in the chrome browser.

Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.

How can I fix above error?

7 5 2
3,870 points

1 Answer

0 votes

Solution :

I had also faced the similar issue in the recent past. I did lot of research on it and found the solution on it. This is the very common problem with the people getting started. You need to do a replace on the commas to just remove them and you should be all right. The function to make the valid filename is as below.

public static string MakeTheValidFileName(string myname)
{
string myinvalidChars = Regex.Escape(new    string(System.IO.Path.GetInvalidFileNameChars()));
string myinvalidReStr = string.Format(@"[{0}]+", myinvalidChars);
string myreplace = Regex.Replace(myname, myinvalidReStr, "_").Replace(";", "").Replace(",", "");
return myreplace;
}

OR

You need to just put the pair of double quotes around the file name as shown below:

this.Response.AddHeader("Content-disposition", $"attachment; filename=\"{outputFileName}\"");

Hope the above solutions provided resolve the issue you are currently facing.

9 7 4
38,600 points

Related questions

1 vote
1 answer 30 views
30 views
Problem : I have recently started working on the User-Agent based shared-session protection which works between sub domains. I am working on two sub domains first one is example.com and and second is sub.example.com I am receiving below USER-AGENT header “ ... HTTP Header which was sent to each domain was different. Is there anybody who can tell me the reason behind such strange behavior?
asked Mar 31 morrisBson 3.2k points
0 votes
1 answer 7 views
0 votes
1 answer 5 views
0 votes
1 answer 16 views
16 views
I just forget my Number . So i need to get it by programmatically.
asked Sep 29 Daniel Anderson 4k points
0 votes
1 answer 4 views
4 views
I am running a photo collage project on Android. I need to know how to implement the collage effect?
asked Sep 25 Daniel Anderson 4k points