Server cannot set content type after HTTP headers have been sent

后端 未结 6 992
离开以前
离开以前 2020-12-20 15:42

I get an error (Server cannot set content type after HTTP headers have been sent.) on the following code (ContentType line). What should I change?



        
6条回答
  •  礼貌的吻别
    2020-12-20 16:03

    I had a very similar issue to this on a webform. I solved this issue by adding the following code to my button in the code behind:

    ScriptManager.GetCurrent(this).RegisterPostBackControl(btnPrint);
    

提交回复
热议问题