asp.net MVC 
前台
<img id="vcodeimg" src="/Home/VCode" width="70"
                                    height="25" />
                                &nbsp;<span
                                    style="cursor: pointer; text-decoration: underline">换一张</span>
控制器
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Utility;
using Jellal**;
namespace sjlwebsite.Controllers
{
    public class CommonController : Controller
    {
        #region 验证码
        [OutputCache(Duration = 0)]
        public ActionResult VCode()
        {
            string code = ValidateCode.CreateRandomCode(4);