Roles.IsUserInRole() can't get it work !!!

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Thread Solved
Reply

Join Date: May 2007
Posts: 8
Reputation: Yamazaki is an unknown quantity at this point 
Solved Threads: 0
Yamazaki Yamazaki is offline Offline
Newbie Poster

Roles.IsUserInRole() can't get it work !!!

 
0
  #1
Dec 29th, 2008
Using ASP.NET Web Admin tool, i created 5 users and assigned them to different roles, but when i try to user Roles.IsUserInRole, it doesn't work, please take a look here:

  1. protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
  2. {
  3. string username = Login1.UserName;
  4. string password = Login1.Password;
  5.  
  6. if (!IsPostBack)
  7. {
  8.  
  9.  
  10. if (Membership.ValidateUser(username, password))
  11. {
  12.  
  13. if (Roles.IsUserInRole("Saleman"))
  14. Response.Redirect("~/Saleman.aspx");
  15.  
  16. else if (Roles.IsUserInRole("Accountant"))
  17. Response.Redirect("~/Accountant.aspx");
  18.  
  19. else if (Roles.IsUserInRole("HR"))
  20. Response.Redirect("~/HR.aspx");
  21.  
  22.  
  23. //Always receive Attempt to login failed message !!
  24. }
  25. }
  26. }
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 8
Reputation: Yamazaki is an unknown quantity at this point 
Solved Threads: 0
Yamazaki Yamazaki is offline Offline
Newbie Poster

Re: Roles.IsUserInRole() can't get it work !!!

 
0
  #2
Dec 29th, 2008
Help plz. ...
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 49
Reputation: iDeveloper is an unknown quantity at this point 
Solved Threads: 7
iDeveloper iDeveloper is offline Offline
Light Poster

Re: Roles.IsUserInRole() can't get it work !!!

 
0
  #3
Dec 29th, 2008
When you created each user did you approve their account? Make sure each user is in the 'approved' status, otherwise they won't validate.
Last edited by iDeveloper; Dec 29th, 2008 at 10:10 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 8
Reputation: Yamazaki is an unknown quantity at this point 
Solved Threads: 0
Yamazaki Yamazaki is offline Offline
Newbie Poster

Re: Roles.IsUserInRole() can't get it work !!!

 
0
  #4
Dec 30th, 2008
Yes they're Active users if that what you mean!
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 8
Reputation: Yamazaki is an unknown quantity at this point 
Solved Threads: 0
Yamazaki Yamazaki is offline Offline
Newbie Poster

Re: Roles.IsUserInRole() can't get it work !!!

 
0
  #5
Jan 2nd, 2009
up...
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 8
Reputation: Yamazaki is an unknown quantity at this point 
Solved Threads: 0
Yamazaki Yamazaki is offline Offline
Newbie Poster

Re: Roles.IsUserInRole() can't get it work !!!

 
0
  #6
Jan 5th, 2009
Problem solved, incorrect syntax, i should use it like that:

Roles.IsUserInRole(string username, string rolename){}
Last edited by Yamazaki; Jan 5th, 2009 at 7:57 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC