Membership.GetUser : Membership « Login Security « ASP.Net






Membership.GetUser

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:LoginView ID="LoginView1" runat="server">
            <LoggedInTemplate>
                You are logged in as
                <asp:LoginName ID="LoginName1" runat="server" />
                <asp:LoginStatus ID="LoginStatus2" runat="server" />
            </LoggedInTemplate>
            <AnonymousTemplate>
                <asp:LoginStatus ID="LoginStatus1" runat="server" />
            </AnonymousTemplate>
        </asp:LoginView>
        <asp:PasswordRecovery ID="PasswordRecovery1" 
                              runat="server" 
                              BorderWidth="1px" 
                              BorderColor="Black"
                              BorderStyle="Solid">
            <MailDefinition From="a@a.com" Subject="Your password request"/>
            <TitleTextStyle ForeColor="#FFFFFF" Font-Bold="True" BackColor="#6B696B" />
        </asp:PasswordRecovery>
    </form>
</body>
</html>

File:Default.aspx.vb

Partial Class Default_aspx
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Membership.GetUser IsNot Nothing Then
            Response.Write("Time is " & Now)
        End If
    End Sub
End Class

 








Related examples in the same category

1.Displaying the number of users online
2.User info
3.Membership.CreateUser