次の方法で共有


LoginName Web Server Control Declarative Syntax

Displays the authenticated user's name on a Web page.

<asp:LoginName
    AccessKey="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    CssClass="string"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
        Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    FormatString="string"
    Height="size"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    runat="server"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    ToolTip="string"
    Visible="True|False"
    Width="size"
/>

Remarks

By default, the LoginName control displays the name that is contained in the User property. If the Name property of the IIdentity interface is empty, nothing is displayed. The User property of the Page class returns a IPrincipal object that exposes an Identity property, which returns an IIdentity object.

For more information on the LoginName control and other login controls, see Login ASP.NET Controls.

Example

The following code example shows how to use the LoginName class on a page.

<asp:LoginName id="LoginName1" runat="server" 
               FormatString="Welcome, {0}" /> 
<asp:LoginName id="LoginName1" runat="server" 
               FormatString="Welcome, {0}" /> 

See Also

Reference

LoginName

Other Resources

Login ASP.NET Controls