在asp.net中获取BIOS日期

 伊金芳60442 发布于 2023-02-08 15:06

我检查管理员是否有许可证所以我按月检查登录我现在使用系统日期检查但管理员更改系统日期所以我想要日期BIOS日期

string crt_val = "",crt_mont = "",crt_year = "";
dt_v = objdata.select_upload();
if (dt_v.Rows.Count > 0)
{
    crt_val = dt_v.Rows[0]["val"].ToString();
    crt_mont = dt_v.Rows[0]["mon"].ToString();
    crt_year = dt_v.Rows[0]["yer"].ToString();
    //yy = Convert.ToInt32(crt_year);
}
else
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true);
    return;
}
if (Verification.Trim() != "")
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true);
    return;
}
string fin="";
string oyear = "";
oyear = DateTime.Now.Year.ToString();
int nyear = DateTime.Now.Year + 1;
int smonth = Convert.ToInt32(DateTime.Now.ToString("MM"));
fin = oyear + "-" + nyear.ToString();
int num;
switch (crt_mont)
{
    case ("January"):
        num = 1;
        break;
    case ("February"):
        num = 2;
        break;
    case ("March"):
        num = 3;
        break;
    case ("April"):
        num = 4;
        break;
    case ("May"):
        num = 5;
        break;
    case ("June"):
        num = 6;
        break;
    case ("July"):
        num = 7;
        break;
    case ("August"):
        num = 8;
        break;
    case ("September"):
        num = 9;
        break;
    case ("October"):
        num = 10;
        break;
    case ("November"):
        num = 11;
        break;
    default:
        num = 12;
        break;
}
if ((num < smonth) || (num == smonth))
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true);
}
else
{
    if (crt_val == "0")
    {
        Session["UserId"] = txtusername.Text.Trim();
        objuser.UserCode = txtusername.Text.Trim();
        objuser.Password = s_hex_md5(txtpassword.Text.Trim());
        string pwd = s_hex_md5(txtpassword.Text);
        objuser.Ccode = ddlCode.SelectedValue;
        objuser.Lcode = ddlLocation.SelectedValue;
        DataTable dt = new DataTable();
        dt = objdata.UserLogin(objuser);
        if (dt.Rows.Count > 0)
        {
            if ((dt.Rows[0]["UserCode"].ToString().Trim() == txtusername.Text.Trim()) && (dt.Rows[0]["Password"].ToString().Trim() == pwd) && (dt.Rows[0]["CompCode"].ToString().Trim() == ddlCode.SelectedValue) && (dt.Rows[0]["LocationCode"].ToString().Trim() == ddlLocation.SelectedValue))
            {
                Session["Isadmin"] = dt.Rows[0]["IsAdmin"].ToString().Trim();
                Session["Usernmdisplay"] = txtusername.Text.Trim();
                Session["Ccode"] = dt.Rows[0]["CompCode"].ToString().Trim();
                Session["Lcode"] = dt.Rows[0]["LocationCode"].ToString().Trim();
                if (Session["Isadmin"].ToString() == "1")
                {
                    Session["RoleCode"] = "1";
                }
                else
                {
                    Session["RoleCode"] = "2";
                }
                Response.Redirect("Dashboard.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('User Name and Password Wrong');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Window", "alert('Please Update your Licence Key');", true);
        }
    }
    else
    { }
}

Piotr Stapp.. 6

获取BIOS日期不会改变任何内容,因为如果有人更改了系统日期,硬件实时时钟也会发生变化.

更好的选择是检查客户端计算机之外的日期,例如检查一些URL.

1 个回答
  • 获取BIOS日期不会改变任何内容,因为如果有人更改了系统日期,硬件实时时钟也会发生变化.

    更好的选择是检查客户端计算机之外的日期,例如检查一些URL.

    2023-02-08 15:09 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有