Chinese image Verification Code

Source: Internet
Author: User
The function is to generate an image and save the text in the image to the session. The source code is downloaded.

Create An ASPX file to provide the verification code image. For example, validcode. aspx, add this event to pageload.

Protected void page_load (Object sender, eventargs E)
Session ["validcode"] = socansoft. validcode. createimage (4, socansoft. validcode. validtype. Numeric );

This page is the page that provides the image source. to test it, the front-end html

<Asp: Image id = "image1" runat = "server" imageurl = "/webbbs/validcode. aspx"/>
<Asp: textbox id = "textbox1" runat = "server"> </ASP: textbox>
<Asp: button id = "button1" runat = "server" onclick = "button#click" text = "button"/> </div>

Background code

Protected void button#click (Object sender, eventargs E)
Bool B = textbox1.text = session ["validcode"]. tostring ();
Response. Write (B. tostring ());

Contact Us

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: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.