避免上传大于10mb的文件(Avoiding upload of files larger than 10mb)
是否有任何方法(可能是一个模块)可以使IIS7拒绝文件大于10mb的帖子?
我的ASP.NET应用程序有一个上传页面,并且该文件不能大于10mb,我相信只有在所有内容都已发送到服务器之后我才能检查文件的大小。
IIS7模块将是正确的选择,任何人都知道一个?
Is there any way (probably a module) that can make IIS7 rejects a post with a file larger than 10mb?
My ASP.NET application has an upload page, and the file cannot be larger than 10mb, I believe that I can check the size of the file only after everything was already sent to the server.
An IIS7 module would be the right choice for this, anyone knows about one?
原文:https://stackoverflow.com/questions/533039
最满意答案
我通过使用下面的代码修复了我的问题。
$('#Testtextbox').bind('keypress', function (event) { var regex = new RegExp("^[a-zA-ZşŞıİçÇöÖüÜĞğ. ]+$"); var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); if (!regex.test(key)) { event.preventDefault(); return false; } });
创建正则表达式时出错的问题。
I fixed my problem by using below code.
$('#Testtextbox').bind('keypress', function (event) { var regex = new RegExp("^[a-zA-ZşŞıİçÇöÖüÜĞğ. ]+$"); var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); if (!regex.test(key)) { event.preventDefault(); return false; } });
The problem caused of making mistake while creating regex expression.
相关问答
更多-
我创建了一个名为“DisallowSpecialCharatersTextBoxBehavior”的静态类,它利用了WPF中可附加属性的强大功能,如下所示: public static class DisallowSpecialCharactersTextboxBehavior { public static DependencyProperty DisallowSpecialCharactersProperty = DependencyProperty.RegisterAttach ...
-
我通过使用下面的代码修复了我的问题。 $('#Testtextbox').bind('keypress', function (event) { var regex = new RegExp("^[a-zA-ZşŞıİçÇöÖüÜĞğ. ]+$"); var key = String.fromCharCode(!event.charCode ? event.which : event.charCode); if (!regex.test(key)) { ...
-
jQuery验证正则表达式以禁止数字和特殊字符(jQuery validate regex to disallow numerics and special characters)[2023-01-02]
正确的答案之一是: return /^[A-Z]+$/i.test(value); 并添加 checkallowedchars: true, 遵守规则。 看到更新的演示小提琴 (下面的那个对我不起作用,不知道为什么)。 $(document).ready(function () { $.validator.addMethod("pwcheckallowedchars", function (value) { return /^[a-zA-Z0-9!@#$%^&*( ... -
为输入添加一个id (例如'验证')并使用: document.querySelector('#validate').onkeypress = validate; function validate(e) { e = e || event; return /[a-z0-9]/i.test( String.fromCharCode(e.charCode || e.keyCode) ) || !e.charCo ...
-
最后我为此创建了一个自定义插件,希望对某人有所帮助 CKEDITOR.plugins.add('customcontentfilter', { afterInit: function (editor) { var dataProcessor = editor.dataProcessor, dataFilter = dataProcessor && dataProcessor.dataFilter, htmlFilter = dataProcessor && dataP ...
-
jquery中的特殊字符(Special characters in jquery)[2022-06-07]
有关详细信息,请参阅此SO问题 。 就个人而言,我认为ID应该符合人类可读,易于理解的ID。 考虑使用不同的机制附加URL,例如jQuery的$.data ,或其他没有有效性限制的属性。 See this SO question for more info. Personally, I believe IDs should conform to human-readable, easily-understandable IDs. Consider attaching URLs using a differe ... -
功能: $('#ta_0').alphanum({ disallow : '<>{}' }); 不会将输入字符作为值返回,它返回使用jQuery选择器选择的输入数组,在本例中为#ta_0 。 由于这些输入存在于您的页面上,因此它将始终返回true,这会导致弹出窗口继续运行。 您必须以几种方式重构代码。 移动$('#ta_0').alphanum({ disallow : '<>{}' }); 键盘功能之外 找到列入黑名单的输入的密钥代码(<> {}) 根据这些密钥代码检查密钥功能内的事件 (在本例中为e ) ...
-
您需要对某些正则表达式部分使用交替(
/?>被视为单独的字符< , b等),而/-<正在创建一个范围,接受比您想象的更多的字符: 因此,我建议使用 ^(?:[\u00BF-\u1FFF\u2C00-\uD7FF\w ",.()/:;-]|"|
)+$ 在C#中,使用逐字字符串文字: @"^(?:[\u00BF-\u1FFF\u2C00-\uD7FF\w "",.()/:;-]|"|
)+$" 请参阅regexstorm上的演示 我假设 ... -
具有特殊字符的jQuery自动完成(即ö,Ä,é或ß)(jQuery Autocomplete with Special Characters (i.e. ö, Ä, é, or ß))[2022-09-16]
在A List Apart上有一篇很棒的文章,其中包含一些Javascript代码 var accentMap = { 'á': 'a', 'é': 'e', 'í': 'i', 'ó': 'o', 'ú': 'u' }; function accent_fold(s) { if (!s) { return ''; } var ret = ''; for (var i = 0; i < s.length; i++) { ret ... -
假设您的代码保存为UTF-8,您可以将该字符用作字符串 $("#toggle2").on("click", function () { if ($(this).html()=='∅') { $(this).html("O"); } }); 或者你可以通过字符代码来完成它 $("#toggle").on("click", function () { if ($(this).html().charCodeAt(0)==8709) { $(this).ht ...