Common user rights management system component version 4.0 - Interface input security check - examples do large-scale development of software systems ...

Company to conduct large-scale software systems development, need to put some programs are key examples of good writing, in order to strengthen the security of software systems, to do security checks the contents of the input interface, the following is the effect of running the program.

Security check code reference to the following

private bool CheckInputSearch()
        {
            bool result = true;
            if (!BaseCheckInput.SqlSafe(this.txtSearch.Text))
            {
                this.txtSearch.SelectAll();
                this.txtSearch.Focus();
                result = false;
            }
            return result;
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (this.CheckInputSearch())
            {
                // 设置鼠标繁忙状态,并保留原先的状态
                Cursor holdCursor = this.Cursor;
                this.Cursor = Cursors.WaitCursor;
                this.FormLoaded = false;
                // 设置查询条件
                this.Search();
                this.SetSearch();
                this.FormLoaded = true;
                // 设置鼠标默认状态,原来的光标状态
                this.Cursor = holdCursor;
            }
        }

 

 

Reproduced in: https: //my.oschina.net/iwenr/blog/227608

Guess you like

Origin blog.csdn.net/weixin_34146805/article/details/91674166