This article is a mirror article of machine translation, please click here to jump to the original article.

View: 185097|Reply: 40

[Communication] WebAPI implements graphical verification code function

[Copy link]
Posted on 3/21/2019 1:08:30 PM | | | |
Recently, I received a task to add a graphic verification code when sending an SMS verification code.
Step 1: Find the code to generate the graphic verification code from the Internet, and find several types as follows (adjust the style according to the style of your personal website):


Step 2: Implement the verification function.
Option 1:
The verification code is stored in the session, but the webapi disables the session by default, and you need to configure it manually;
Find the Global.asax file in the interface project and add the following code:

Problem: After depositing the session, when verifying the value, it is found that the session has always been null due to the separation of the front and back ends.
Solution: Use CORS to solve WebAPI cross-domain problems;

Option 2:
Store the verification code in the cache and select redis;
Note: Clear the corresponding cache data in time after verification is completed. The cache time setting is not too long.
Achieve results:


Source code download address: WebAPI implements graphical verification code verification .rar
Download

Tourists, if you want to see the hidden content of this post, pleaseReply









Previous:Thursday, March 21, 2019
Next:IPv4 and IPv6 address lengths
 Landlord| Posted on 10/20/2020 9:16:10 AM |
qqjqqj Posted on 2020-10-16 09:02
When you register, reply, click download and show that you have no permission and need to open a membership

I think this process is also a bit problematic, and the reply should be omitted, and then it will be much better to operate
Posted on 4/29/2019 9:36:34 PM |
After depositing the session, when verifying the value, it is found that the session has always been null due to the separation of the front and back ends, and there is a cross-domain problem.
Solution: Use CORS to solve the WebAPI cross-domain problem
 Landlord| Posted on 5/17/2019 9:46:03 AM |
ChinaBoyZY Posted on 2019-5-16 20:31
This, I am using, learning. Thank you, God

I'm a scumbag and learn together
Posted on 3/21/2019 4:03:09 PM |
Graph validation, learning
Posted on 4/17/2019 9:57:26 AM |
Learn to learn
Posted on 5/16/2019 8:31:25 PM |
This, I am using, learning. Thank you, God
Posted on 6/12/2019 3:38:57 PM |
Cows
Posted on 6/22/2019 4:07:20 PM |
kankan......
Posted on 6/27/2019 4:37:37 PM |
Yes, I learned
Posted on 6/28/2019 10:42:34 AM |
Look, I'll see if it's a number
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com