Basic Authentication (C#) : Authentication « Development « ASP.Net






Basic Authentication (C#)

<%--


       
<html>
<head>
  <script language="C#" runat="server">
    void Page_Load(Object Src,EventArgs E)
    {
        lblUser.Text = User.Identity.Name;
        lblType.Text = User.Identity.AuthenticationType;
    }
  </script>
</head>
<body>
    <font face="Verdana" size="4" color="navy">
    <b>Windows Authentication</b></font><hr>
    <table border=1 bordercolor="#FFFFFF" bgcolor="Silver" 
    cellspacing=0 cellpadding=4>
      <tr>
        <td><b>Current Users Name</b></td>
        <td><asp:label id=lblUser runat=server/></td>
      </tr>
      <tr>
        <td><b>Current Authentication Type</b></td>
        <TD><asp:label id=lblType runat=server/></TD>
      </tr>
    </table>
</body>
</html>

--%>

<%-- web.config
<configuration>
  <system.web>
    <authentication mode="Windows" />
  </system.web>
</configuration>

--%>


           
       








Related examples in the same category

1.Displaying the authentication status in ASP.NET
2.User.Identity.IsAuthenticated (VB.net)
3.User.Identity.Name (VB.net)
4.Context User Identity Name (VB.net)
5.Get current user name and Authentication Type (VB.net)
6.Form based login (C#)
7.Form and database based authentication (C#)