如何在asp.net网站中允许撇号 [英] How to allow apostrophe in asp.net website
问题描述
在我的asp.net网站上,我用用户的详细信息创建用户,如果假设用户的姓氏是 Sam's
,然后当我编辑用户时,文本框中的显示为 Sam' s
,但在数据库中它存储为Sam's,当我尝试更新时名称为Sam的名称,然后出现以下错误,如何在文本框中显示名称 txt_EditLastName.Text = gvrow.Cells [2] .Text;
In my asp.net website I create user with their details, If suppose the surname of the user is
Sam's
then when I edit the user the display in the text box is Sam's
but in database it is stored as Sam's, and When I just try to update name as Sam's then i get the error below, How should I show the name in the text box txt_EditLastName.Text = gvrow.Cells[2].Text;
A potentially dangerous Request.Form value was detected from the client (ctl00$MainContent$txt_EditLastName="Sam's").
推荐答案
我收到此错误是因为Visual Studio 2010增加了一点安全性.要解决此问题,您需要在页面指令中添加 ValidateRequest ="false"
或在 web中添加
文件.首先,我将其放置在错误的位置,因此请确保将其放置在< pages validateRequest ="false"/>
.config web.config
文件的< system.web>
区域中.
I got this error because Visual Studio 2010 added a little bit of security. To work around it you need to add ValidateRequest="false"
to the page directive or add <pages validateRequest="false" />
in the web.config
file. I put it in the wrong spot at first, so make sure you put that in the <system.web>
area of your web.config
file.
此链接会有所帮助. http://www.cryer.co.uk/brian/mswinswdev/ms_vbnet_server_error_potentially_dangerous.htm
这篇关于如何在asp.net网站中允许撇号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!