Why does adding a newline to StatusDescription in ASP.Net close the connection?

后端 未结 1 582
天涯浪人
天涯浪人 2020-12-06 11:55

When I return a StatusDescription with a newline using the HttpStatusCodeResult from ASP.Net MVC 3.0, the connection to my client is forcibly closed. App is hosted in IIS 7.

相关标签:
1条回答
  • 2020-12-06 12:10

    You can't have a linebreak in the middle of an HTTP header.

    The HTTP protocol specifies the end of a header is a line break.

    Since the line break is in the middle of a header, the header is not a valid header and you are getting this error.

    Fix: Don't put a line break in the middle of an HTTP header.

    0 讨论(0)
提交回复
热议问题