开发者

RequiredFieldValidator - So if Javascript is disabled the whole .NET controls are avoided?

I'm using .NET recently, and I check some fields.

I know that the开发者_如何学编程 check is client-side (javascript) and on server-side with :

Page.Validate();

if (!Page.IsValid)
{
}

But if the javascript is disabled all of them are not checked (in fact the javascript return false when I try to do the request to the server.

So, is this a limitation of .NET or there are other way to do these check without JS?


You are right, using Page.IsValid will only return correct value if javascript is enabled / supported in the browser. So, good web programming practice is to run same validations again at server side regardless of client side validation consideration. Because client side javascript can be altered easily in browser to bypass that the validations.

That will ensure you are accepting correct values.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜