19 Nisan 2013 Cuma

C# Web sayfasi kullanıcı adi sifre sorsun

C# Web projenizin daha ilk sayfa gelmeden kullanıcı adı ve şifre sormasını istiyorsanız aşağıdaki işlemleri yapmanız gerekmekte.

IIS yöneticisinde Authentication bölümünde Basic Authentication seçili olması gerekiyor. Eğer bu seçenek aktif değil ise;

Control Panel \ Program and Features \ Turn Windows Features on or off \ Internet Information Services \ World Wide Web Services \ Security\  Basic Authentication özelliğini aktif etmeniz gerekmektedir.

Login olunan kullanıcı bilgisine ulaşmak için gerekli kod;

using System.Web.Security;


    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = User.Identity.Name;
    }


Share: