Click here to Skip to main content
15,904,023 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an Website. In that Several Webpages are there with Master Page. I have a database as Login.which has user id user name full name role Email columns are there. All users are Ad authenticated. When a user logon how its full Name will display in all the pages with date and time.i am new in asp .net.kindly solve it. I have not used the login control.
My code is
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AMC Login</title>
<link rel="stylesheet" href="CSS/Styles.css" type="text/css" />
<style type="text/css">
.style1
{
width: 100%;
height: 30px;
}
.style2
{
font-family: verdana;
font-size: 7.5pt;
color: #000000;
font-family: Verdana;
font-weight: 700;

}
.style3
{
background-repeat:no-repeat;
}
</style>
</head>
<body >
<form id="form1" runat="server">


<asp:Image ID="imgLogo" runat="server" ImageUrl="images/logo.png" Width="235" Height="50" />
<asp:Label ID="lblHeading" runat="server" Text="Hardware Management" CssClass="txtspanHead"
Font-Size="X-Large">
<asp:Image ID="imgHeader" runat="server" ImageUrl="~/images/footer.jpg" Height="35px"
Width="1000px" ForeColor="#FF9900" GenerateEmptyAlternateText="True" />
Welcome to FSPL_AMC
removed="hands.png" >

<%-- --%>

style="width: 100%">
<fieldset id="fsLogin" runat="server" class="fieldset" align="right"
atomicselection="True">
Login

style="height: 148px; width: 148px" bgcolor="White">
Fspl User Login
Name
<asp:TextBox ID="txtUName" runat="server" Height="10px" Width="150px" CssClass="txtbox" >
Password
<asp:TextBox ID="txtPwd" runat="server" TextMode="Password" CssClass="txtbox"
Width="150px">
<asp:Label ID="lblmessage" runat="server" Text="" Font-Bold="true">
<asp:CheckBox ID="chkPersist" runat="server" Font-Size="6pt" Visible="False" Width="62px" />
<%--<asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" CssClass="txtBtn" />--%>
<asp:ImageButton ID="imgbtnLogin" runat="server" ImageUrl="~/images/button_login.gif"
OnClick="btnLogin_Click" CssClass="txtBtn" />


 
 
 
 
 

<asp:Image ID="Image1" runat="server" ImageUrl="~/images/Computer-Support.png" Height="200px"
Width="350px" />


<asp:Image ID="imgFooter" runat="server" ImageUrl="~/images/header.jpg" Height="18px"
ImageAlign="Left" Width="1000px" />

</form>
</body>
</html>
Posted
Comments
Member 10578683 11-Feb-14 1:27am    
will i put this code in master page ?please tell me in detail

1 solution

you can get the user currently logged on like so.


string user = User.identity.Name;
Label1.Text = user;
or
user= System.Web.Security.Membership.GetUser().Username;

alternatevely you can create an instance of userprofile/membership class and get properties.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900