1. Create a new. NET Core MVC Project2. Add a class MyAttribute below the Models folder, which is designed to hold the attributes we defineHere, I only wrote checkloginattribute to verify the login situation.usingMicrosoft.AspNetCore.Http;usingMICROSOFT.ASPNETCORE.MVC;usingMicrosoft.AspNetCore.Mvc.Filters;usingSystem;namespaceattributestudy.models{ Public classMyAttribute {} Public classCheckloginattribute:attribute,iactionfilter { Public voidOnAction
Example
The code is as follows
Copy Code
var tel = 18767802354;var reg =/^0?1[3|4|5|8][0-9]\d{8}$/;if (Reg.test (tel)) {Alert ("Correct number ~");}else{Alert ("Wrong number ~");};
Match the phone number at the beginning of 13,14,15,18!
Example
Verify mobile phone Number one
The code is as follows
Copy Code
String.prototype.ismobile = function () {Return (/^ (?: 13d|15[89])-?d{5} (D
Are simple examples, so send the code directly
Static page ajax.html
Copy Code code as follows:
Call function when the account input box loses focus
The access server uses a Get method, so additional random code is used at the parameter to avoid caching.
Verify page validate.aspx background code:
Copy Code code as follows:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using Sys
This article illustrates how PHP uses Ereg to verify file uploads. Share to everyone for your reference. The specific analysis is as follows:
The Ereg format is as follows:
Copy Code code as follows:
Ereg (regular expression, string, [match part array name]);
Here we use the Ereg to verify that the file types uploaded by the user and file names are in accordance with the file naming rules,
ExtJS has packaged components to achieve file upload function is very convenient, but for many ExtJS novice does not know how to control the file upload type, such as when we just want to let users upload ' txt ' type of files, how to achieve when users upload non ' TXT ' file, give the wrong hint? The validator validator using the field component should be a convenient way to verify the file type.In extjs4.x How to implement the password verification
This article describes the JavaScript and PHP to verify the user input URL is the correct way to share with you for your reference. The specific methods are as follows:
1.javascript Detect URL address validity:
Copy Code code as follows:
Url:
2.PHP Detect URL address validity
Copy Code code as follows:
?
function Is_url ($STR) {
Return Preg_match ("/^http://[a-za-z0-9]+.[ a-za-z0-9]+[/=?%-_~ ' @[] ': +!] * ([^
NPM Install always complains: Unable to verify of the first certificate (unable to verify the primary certificate), check the discovery
As of February, 2017, NPM no longer supports its self-signed certificates.
February 27, 2017, NPM no longer supports self-signed certificates.
Because NPM install is going with the HTTPS protocol, a digital certificate is required to guarantee solution 1:
Canceling SSL
When we do various programming design, we often encounter the need for personnel registration, but the information on the registration of people to verify the means but also
Very ineffective, because it is difficult for us to judge whether a person's information is true or not! We just try to check his message as much as possible.
Now let's take a look at some simple school as tests on the ID card.
1 2 3 4 5
XX XXXX XXXXXX xx X This is the form of an
Both XML schema and DTD are used for document verification, but there are some differences between them. The former is more accurate and flexible:
DTDDTD does not comply with XML syntaxThe DTD cannot be expanded.DTD does not support namespace applicationsThe DTD does not provide powerful data type support and can only represent simple data types.
SchemaSchema is fully based on XML syntaxCan be processed using tools for processing XML documentsGreatly expanded data typesSupports prototype, that i
booleanexpression parameter is a bool expression.2. When the program runs the Statement, the program checks the expression booleanexpression.
Is it true or false.When the conditions are met, the program continues to run the following code;When the conditions are not met, the program will be stuck here for continuous running, not running down, and
The program prompts an error dialog box, indicating that the booleanexpression condition is not met.
Errors.3. This command can be used as a protectio
In php programs, regular expressions are generally used to verify email addresses, IP addresses, and URLs. In fact, some Built-in validation rules are provided in php. The following example describes how to use the built-in filter function of php to verify email, ip, and URL.
1. verify email
$ Email = 'phpernote @ 163.com '; $ result = filter_var ($ email, FILTER
PHP program to verify the mailbox, IP address or URL in general, we will use regular expressions to deal with, in fact, there are some built-in PHP special validation rules. Here's an example of how to use the PHP built-in filter function to validate Email,ip and URLs.
1, verify the mailbox
$email = ' Alixixi@163.com ';
$result =filter_var ($email, filter_validate_email);
Var_dump ($result);
Output: St
PHP uses the Luhn algorithm to verify whether the credit card number is valid. PHP uses the Luhn algorithm to verify whether a credit card number is valid. This article mainly describes how PHP uses the Luhn algorithm to verify whether a credit card number is valid, the example analyzes the Luhn algorithm implemented by php and the Luhn algorithm used by PHP to
PHP: how to verify whether the entered bank card is valid? I am currently making an error entry. when I enter a bank card, I want to verify whether the bank card is valid, it is like an ID card. if you can verify whether the character string meets the requirements, find the complete code! I heard that there is a luhn algorithm, but this seems incomplete. Who gave
How to Use SHA256 to verify downloaded files
When you download an ISO image, especially from many unknown seeds on the BitTorrent network, we recommend that you verify the integrity of the downloaded image.
For the Ubuntu release, Canonical provides several verification files (such as MD5SUM, SHA1SUMS, and SHA256SUMS) for verification ). In this example, we use SHA256SUMS.
First, download the following tw
Article Title: Verify the software package validity before installing software on Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In the past, I used to say "small is beautiful" to Linux experts ". This statement tells us the design features of the Linux operating system. Different from Microsoft, a Linux op
Use the GnuPG encrypted signature to verify the reliability and integrity of the downloaded file
After you download a file from the Internet (such as the installer, ISO image, or a compressed package), the file may be damaged under different circumstances, for example: due to line transmission errors, interrupted downloads, storage hardware errors, file system errors, and so on. In addition to these errors, files may be intentionally tampered with bef
Php uses openssl_verify to verify the signature instance program. Next let's take a look at the example program for verifying the signature using openssl_verify in php. I hope this article will be helpful to you. The code is as follows: Copy the code? Php *** to verify the signature, let's take a look at php's use of openssl_verify to verify the signature instanc
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.