开发者

When a text box contains the <BR/>, Button is not getting clicked

I have web application in ASP.NET

In application I have web page contains a text box for Book Details to entered.

I want user to enter <BR/> in that TextBox.

When a text box contains the <BR/> string a Button which submit data to server is not getting clicked. I dont want user should enter &lt BR/ &gt line in TextBox instead of <BR/>开发者_如何学Go;

Any help?


By default ASP.Net will reject any postback that contains anything that looks like XSS.

For instance <script>alert('xss');</script> is blocked.

But <br /> is blocked too, and most sites turn this off - it depends on whether you're using WebForms or MVC.

For WebForms add <pages validateRequest="false"> to the <system.web> section of your config or if you only want that page can have a POST with HTML tags, you can also add the validateRequest="false" to the top of your asp.net page inside the <@ directive

For MVC add [ValidateInput(false)] to your action or controller.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜