从渲染页面生成pdf时出现问题 [英] problem in generating pdf from rendered page

查看:371
本文介绍了从渲染页面生成pdf时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想从渲染的页面生成pdf文件时,出现以下异常.

只能在Render()期间调用RegisterForEventValidation;

说明:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息.

异常详细信息:System.InvalidOperationException:仅可在Render()期间调用RegisterForEventValidation;

源错误:

第52行:RenderControl(htmlTextWriter); <-我在这里有异常
第53行:Response.Write(stringWriter.ToString());
第54行:Response.End();

when i want to generate pdf file from rendered page then i got following exception.

RegisterForEventValidation can only be called during Render();

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: RegisterForEventValidation can only be called during Render();

Source Error:

Line 52: RenderControl(htmlTextWriter); <-- I got exception here
Line 53: Response.Write(stringWriter.ToString());
Line 54: Response.End();

推荐答案

我不知道您的代码.根据错误消息,我找到了此修复程序链接

只能在Render()期间调用RegisterForEventValidation [ ^ ]
I don''t know about your code. Based on the error message I found this fix link

RegisterForEventValidation can only be called during Render()[^]


这篇关于从渲染页面生成pdf时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆