在ASP.NET中防止同一台机器访问 浏览数增加

来源:互联网 发布:注册域名需要多少钱 编辑:程序博客网 时间:2024/05/17 04:38

   if (!this.IsPostBack)
   {
    string JobID="";
    if (Request.QueryString["JobID"]==null)
    {
     this.Response.Write("<script language='javascript'>alert('非法操作');document.body.innerHtml = '非法操作';</script>");
     return;
    }
    JobID=this.Request.QueryString["JobID"].ToString();

    string sSessionJob = "Job"+this.Request.ServerVariables["REMOTE_HOST"];
    if (this.Session[sSessionJob] == null)
    {
     Session.Add(sSessionJob,JobID);
     string sqlupdatejob="update BZ_Data_Job set Tickcount=Tickcount+1 where JobID="+JobID+"";
     EYuanT.CommLib.clsDB.doGetDBManager().doAddRecord(sqlupdatejob,null);
    }
    string sqljob="select * from BZ_Data_Job where JobID="+JobID+"";
    System.Data.DataSet dsjob = EYuanT.CommLib.clsDB.doGetDBManager().doGetData(sqljob);
    this.JobName.Text = dsjob.Tables[0].Rows[0]["JobName"].ToString();
    this.JobPlace.Text = dsjob.Tables[0].Rows[0]["JobPlace"].ToString();   
    this.JobRemark.Text =dsjob.Tables[0].Rows[0]["JobRemark"].ToString().Replace("<","&lt").Replace(">","&gt").Replace(" ","&nbsp;").Replace("/n","<br/>");
    this.ManCount.Text = dsjob.Tables[0].Rows[0]["ManCount"].ToString();
    this.JobDate.Text = dsjob.Tables[0].Rows[0]["JobDate"].ToString();
    this.kicknum.Text= "("+"阅读次数"+dsjob.Tables[0].Rows[0]["TickCount"].ToString()+")";
    string sqldep="select * from BZ_Dic_Depart where DepartID="+dsjob.Tables[0].Rows[0]["DepartID"].ToString()+"";
    System.Data.DataSet dsdep = EYuanT.CommLib.clsDB.doGetDBManager().doGetData(sqldep);
    this.DepartName.Text = dsdep.Tables[0].Rows[0]["DepartName"].ToString();
   }

原创粉丝点击