本文介绍了同时很多人在asp.net中打开一个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

用户不能同时进入网站.例如,有一个控制面板,用户名和密码.用户输入名称,然后输入密码,然后单击按钮(输入).但是,如果有多个人可以同时进入该网站,那么它将返回错误.

我怎么解决这个问题?我该怎么用?

问候

哈鲁克

Hello guys,

The users cannot enter the website at the same time. For example, there is a control panel, user name and password. The user enters the name and then password, after that click the button (enter). But, if more than one people can enter this website at the same time then it returns an error.

How can I solve this problem? What should I use?

Regards

Haluk

namespace mekmersite.admin
{
    public class Kullanici
    {

        private bool _kontrol;

        public bool Kontrol
        {
            get { return _kontrol; }
            set { _kontrol = value; }
        }

        private bool _btClick;

        public bool BtClick
        {
            get { return _btClick; }
            set { _btClick = value; }
        }

        public Kullanici()
        {
            this.BtClick = false;
        }

        public void Kontrolet(string kullanici,string sifre)
        {
            string sorgu = "SELECT COUNT(*) FROM LOGIN WHERE USERNAME='" + kullanici + "' AND PASSWORD='" + sifre + "'";
            if (Metotlar.Connection.Komut.IntegerVeriOku(sorgu, 0) > 0)
                this.Kontrol = true;
            else
                this.Kontrol = false;
        }
    }
}





public partial class login : System.Web.UI.Page
{
    //VeriServisi.KullaniciKontrolClient veri = new VeriServisi.KullaniciKontrolClient();
    admin.Kullanici kn = new admin.Kullanici();
    //protected void Page_PreRender(object sender, EventArgs e)
    //{
    //}

    protected void ASPxButton1_Click(object sender, EventArgs e)
    {

        kn.Kontrolet(txt_username.Text, txt_pass.Text);
        if (kn.Kontrol)
        {
            FormsAuthentication.RedirectFromLoginPage(txt_username.Text, true);
            Response.Redirect("~/Default1.aspx");
        }
        else
            Response.Write("Yanlış Giriş Yaptınız");

    }
}

推荐答案


这篇关于同时很多人在asp.net中打开一个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 05:53