Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2009, 09:33 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default How to Change the page content Per User

Hi there i am developing an application for a coompany with 20 users and they have their user name /password in order to log in. The users need to have spesific Controls displayed in the page based on whaat i am going to assign them.(something similar in the Wrox United/FunClub.aspx in the button save).
From the admin Page i need to Select a User and asign him/her values/controles to be displayd after they have loged in.

i was thinking about loginview controll ? and i need to bind data from a sql Sqerver 2005
__________________
bx
 
Old January 15th, 2009, 12:43 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Hi,

I don't have any experience with the loginview control but I found some good info and some source code for implementation.

http://quickstarts.asp.net/QuickStar...spx#createuser

I have an application where I created the login and authorization with roles, menu groups and page by page features. The authorization is stored in Session variables.
 
Old January 15th, 2009, 02:29 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Code:
<asp:LoginView ID="LoginView1" runat="server">
   <RoleGroups>

      <asp:RoleGroup Roles="Manager">
         <ContentTemplate>
            <p>Hi there! You are a Manager!</p>            
         </ContentTemplate>
      </asp:RoleGroup>

      <asp:RoleGroup Roles="Employee">
         <ContentTemplate>
            <p>
               Hi there! You are an Employee!</p>            
         </ContentTemplate>
      </asp:RoleGroup>
   </RoleGroups>

   <LoggedInTemplate>
      <p>
         Hi there! You belong to no roles.</p>
   </LoggedInTemplate>

</asp:LoginView>
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
Old Pedant (January 15th, 2009)
 
Old January 15th, 2009, 06:58 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Man, if that were any simpler you could let it write itself. Never used LoginView before. Because I "grew up" with roll-your-own authentication. Now you are making me rethink some pages. Thanks!
 
Old January 15th, 2009, 07:18 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You're welcome!
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old January 15th, 2009, 10:14 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Hi Lee,

Thanks for the post. Where does all the role and user/role info get stored? I feel like this might be a dumb question, but don't you still have store this info in a database somehow?

Thanks,
Richard
 
Old January 15th, 2009, 11:52 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Try this link:
http://aspnet.4guysfromrolla.com/articles/121405-1.aspx

Have known about those pages since they first appeared. Now I may actually go read them.
 
Old January 16th, 2009, 12:17 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
Originally Posted by rstelma View Post
Hi Lee,

Thanks for the post. Where does all the role and user/role info get stored? I feel like this might be a dumb question, but don't you still have store this info in a database somehow?

Thanks,
Richard
Yeah, you have to set this all up in a database, and there are membership and role providers you can set up in web.config that will let you work with the data. Fortunately, ASP.NET comes with tools that assist in setting up the dB schema and sprocs automatically.

Scott Mitchell's articles linked above will help, and there is also a whole series of videos at http://asp.net that demonstrate how memberships and roles work.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old January 16th, 2009, 01:51 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Thank you for the replies.

This sounds great. Now, if there's only a way to keep track of what roles get what permission on which pages.

Sounds like it's time for an old dog learn some new tricks.

Thanks,
Richard
 
Old January 16th, 2009, 03:40 PM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

Ok what about this:
on the log in page i have a login name controll that shows the name of the user loged in, now i need to check if login name = test then
lblconntrol1= a row from the database table that is = to the user name.
on the table i have 2 columns 1=user, 2= template
can you see what i am trying to do ?
__________________
bx





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change content of setup.exe bijgupt Other Programming Languages 1 July 22nd, 2008 06:24 AM
change content of textarea from select darkhalf Javascript 1 April 26th, 2007 06:03 AM
How to change the value of content of meta object Abdul Hameed HTML Code Clinic 2 August 12th, 2004 04:40 AM
How to change the value of CONTENT of META object Abdul Hameed Javascript 1 August 11th, 2004 10:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.