2008年3月20日 星期四

要能讀取或寫入包含有 Html Tag的字串

問題(要能讀取或寫入包含有 Html Tag的字串)
This was added in .NET framework 1.1 and basically it means that you can't post values containing HTML ( or script ) tags to the server.

錯誤訊息:
A potentially dangerous Request.Form value was detected from the client

解決方法:加入以下這行web.config
pages validaterequest="false"

Validation of viewstate MAC failed

錯誤訊息:
Validation of viewstate MAC failed. If this application is hosted by a Web farm or cluster,
ensure that configuration specifies the same validationKey and validation algorithm.
AutoGenerate cannot be used in a cluster.

解決方法:加入以下這行在web.config

pages enableeventvalidation="false" viewstateencryptionmode ="Never"