What could be causing this corruption in .docx files during httpwebrequest?

妖精的绣舞 提交于 2019-11-30 16:12:21
Jon P Smith

I recently played about with multipart/form-data and noticed it has an extra –- on the end of the final multipart boundary. There is an example in this stackoverflow answer. I think that is where you are losing the two bytes.

If so the solution is to add a final write to the request stream of two bytes of 45 (ASCII -).

stream.Write(new byte[]{45, 45}, 0, 2);

I can't be sure, but it looks like a good fit. Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!