ASP.Net 动态数据站点中的 Xml 数据
我遇到这个问题,无法让动态数据 Web 应用程序将 xml 数据保存到文本字段中。 也许这是一个常见问题,但搜索网络并没有给我任何答案......
所以这里是重新创建我的问题的步骤:
- 我有一个数据库,其中有一个表,其中有一列类型为“ntext”(Sql Server 2005)。
- 我创建一个新的动态数据实体 Web 应用程序,在其中创建一个 ADO 实体数据模型并添加带有 ntext 列的表。
- 我设置了 global.ascx 文件并启动了 Web 应用程序。
- 当 Web 应用程序打开时,我导航到表并插入一个新项目。
- 在生成的代表 ntext 列的文本框中,我插入一些 xml(从记事本简单剪切和粘贴),然后单击“插入/保存”按钮。
插入失败并出现错误:
Microsoft JScript 运行时错误:Sys.WebForms.PageRequestManagerServerErrorException:在服务器上处理请求时发生未知错误。 从服务器返回的状态代码为:500
尝试的 xml 示例
<?xml version="1.0" encoding="utf-8"?>
<root>
<item></item>
</root>
键入字符串,例如“hello world”有效!
谁能帮助并告诉我哪里出错了?
谢谢
I have this problem where I can't get my dynamic data web app to save xml data into a text field. Maybe this is a common problem but searching the web doesn't give me any answers...
So heres the steps to recreate my problem:
- I have database with a table that has a column of type "ntext" (Sql Server 2005).
- I create a new Dynamic Data Entities Web Application, within this I create an ADO Entity Data Model and add the table with the ntext column.
- I setup the global.ascx file and fire up the web app.
- When the web app opens I navigate to the table and insert a new item
- In the text box thats generated and represents the ntext column, i insert some xml (simple cut and paste from Notepad) and hit the Insert/Save button.
The insert fails with a the error:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Example of xml attempted
<?xml version="1.0" encoding="utf-8"?>
<root>
<item></item>
</root>
Typing a string of characters eg "hello world" works!
Can anyone help and tell me where I'm going wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只是作为旁注。
IMO,应尽可能避免为所有页面设置 validateRequest="false"。 每当您遇到必须禁用它的情况时,请在页面级别上设置它(<%@ Page ValidateRequest="false" ..%>。
另外,在执行此操作的页面上,确保您正在验证输入,这样就不会传递任何有害内容。
Just as a sidenote.
Setting validateRequest="false" for all the pages should be avoided when possible, IMO. Whenever you've a scenario where you've to disable it, set it on the page level ( <%@ Page ValidateRequest="false" ..%>.
Also, on the pages where you do this, make sure you're validating the input, so nothing harmful gets passed on.
这可能是因为它看到您在潜在危险请求中添加的内容。 我假设您在页面指令中有 ValidateRequest="true" 。 它是否正确?
It is probably becuase it sees what you are adding in a potential dangerous request. I would assume you have ValidateRequest="true" in the page directive. Is this correct?
我只能说 REA_ANDREW 你是个天才! 我在 web.config 中更新了它,现在它可以工作了:
Can i just say REA_ANDREW you're a genius! I updated this at the web.config and it now works: