Follow me on Twitter at Twitter.com/wbm
FYI, I'm blogging most of my stuff over at More Wally now.
You might want to add my rss feed to your reader at:http://morewally.com/cs/blogs/wallym/rss.aspx
LoginView Control in ASP.NET Whidbey - Wallace B. McClure

Wallace B. McClure

All About Wally McClure - The musings of Wallym on Web, HTML5, Mobile, MonoTouch for iPhone, MonoDroid for Android, and Windows Azure.

News

Personal Blog

Work Blog

.NET

Book Authors

Business

Family

Friends

Georgia Tech Bloggers

Personal

Archives

LoginView Control in ASP.NET Whidbey

First off, special thanks to Stephen Walther for his article on the new security features in Whidbey

I have been looking at the Login controls in Whidbey with great interest given all the cool code that comes with them.  I think that the LoginView Control can give you some interesting data, if you configure it correctly.  I spent a couple of minutes putting it into a form that I can use.  Basically, here is the idea:

  • Anonymous users.  They get the anonymous template information.
  • Logged on users.  They get the logged on user template information.
  • Role users.  These users get the logged on information specific to the role to which they belong in the application.

Here is the configuration for the LoginView Control.  It is fairly simple, but the idea is powerful.

        <asp:LoginView ID="LoginView1" Runat="server">
            <AnonymousTemplate>
                User is not logged in.<br />
            </AnonymousTemplate>
            <LoggedInTemplate>
                User is logged in.<br />
            </LoggedInTemplate>
            <RoleGroups>
                <asp:RoleGroup Roles="Admin">
                    <ContentTemplate>
                        You are an Admin User.<br />
                    </ContentTemplate>
                </asp:RoleGroup>
                <asp:RoleGroup Roles="User">
                    <ContentTemplate>
                        You are a Regular User.<br />
                    </ContentTemplate>
                </asp:RoleGroup>
            </RoleGroups>
        </asp:LoginView>   

The would be very powerful in a footer or some similar location on each page of an application.

Wally

Comments

Jim Bolla said:

Sweet. I'm assuming I can put server controls within each of the template sections, in addtion to text/html. Yes?
# July 20, 2004 2:49 PM

Wally said:

# July 20, 2004 3:12 PM

Sunny said:

I am assuming, i can put login control in that template section.

# December 18, 2007 2:18 AM

Zeeshan said:

How can we access controls such as label within loginview control and how we can change the text of that label?

zeeshan992@hotmail.com

# April 7, 2008 6:17 PM

Zeeshan said:

How to access the label control in the loginveiw control and how to change the text value.

# April 7, 2008 6:26 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)