Login Controls[5]->LoginName

The LoginName controls displays the currently authenticated user's name on the page. It uses the value returned by calling page.user.identity. If the user is not currently logged in then the control does not render on the page and does not hold any visual space on the page. The LoginName control supports the standard web control style properties to control its display. The FormatString property enables you to insert the users name in a string of text. It will replace the {0} value with the user's identity at runtime. In this example, we have set the value to Welcome {0}!

LoginName Sample

To view the LoginName control in this sample you must first login to the website. Use one of the user accounts as listed in the sample web page.

C# LoginName1.aspx
Run Sample View Source

posted on 2007-05-14 10:05  改变热爱  阅读(159)  评论(0)    收藏  举报

导航