DotNet.WebApplication/ValidateHelper.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//-----------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2013 , Hairihan TECH, Ltd .
//-----------------------------------------------------------------
using System;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using DotNet.Utilities;
public partial class ValidateHelper : Page
{
protected void Page_Load(object sender, EventArgs e)
{
DrawingVerifyCodeImage();
}
#region VerifyCode
public static string SessionNameVerifyCode
{
get
{
return "VerifyCode";
}
}
/// <summary>
/// 画安全码图片
/// </summary>
public static void DrawingVerifyCodeImage()
{
VerifyCodeImage verifyCodeImage = new VerifyCodeImage();
// 取随机码
string code = verifyCodeImage.CreateVerifyCode().ToUpper();
// 输出图片
verifyCodeImage.CreateImageOnPage(code, 3, HttpContext.Current);
// 使用Session取验证码的值
HttpContext.Current.Session[SessionNameVerifyCode] = code;
}
/// <summary>
/// 验证安全码
/// </summary>
/// <param name="code">输入的安全码</param>
/// <returns>成功与否</returns>
public static bool ValidateVerifyCode(string code)
{
if (HttpContext.Current.Session[SessionNameVerifyCode] != null)
{
string verifyCode = HttpContext.Current.Session[SessionNameVerifyCode].ToString().Trim();
if (verifyCode != string.Empty && verifyCode.ToLower() == code.ToLower())
{
return true;
}
}
return false;
}
#endregion
#region Validate
后面还有 57 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
