Advertisement.

TransHimalaya.in

Everest Helicopter Tour for a day

Book exciting packages at www.transhimalaya.in

ASP.NET Security and Authentication.

Add following in web.config File


               <authentication mode="Forms">
      <forms name="f" defaultUrl="default.aspx" loginUrl = "login.aspx" path="/" protection="All">
        <credentials passwordFormat="Clear" >
          <user name="vin" password="1"/>
          <user name="pinx" password="123"/>
          
        </credentials>
      
      </forms>
    </authentication>
    
    <authorization>
      <allow users="vin"/>
      <deny users="pinx"/>
    </authorization>




have 2 page default.aspx and login.aspx
In login.aspt have 2 textbox and 1 button. vb code is:


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If FormsAuthentication.Authenticate(TextBox1.Text, TextBox2.Text) Then
            FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, False)
        Else
            Response.Write("Invalid User")
        End If

    End Sub

Comments

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers