Get All Roles, But A Select Few / Get All The Roles Except Administrator?
Aug 13, 2010
I have run into a problem where I need to remove certain items from collections that seem to only have get all functions.
My Idea is to get the full collection and then remove the unneeded items. Then take that new collection and bind it to whatever I need.
For example How do I get all the roles except administrator?
Roles strRoles = Roles.GetAllRoles()
RoleList.DataSource = (Roles) roles; //Roles.GetAllRoles();
RoleList.DataBind();
or How do I get all users but say user123
MembershipUserCollection users = Membership.GetAllUsers();
UserList.DataSource = users;
UserList.DataBind();
View 1 Replies
Similar Messages:
Apr 8, 2010
we are a small team of student developers and we are making a website with a silverlight application hosted on the sample website of VS 2010(i mean the one you go New website new asp.net website).But we cant understand how the login works or how we can put roles like administrator and such.Also we are using master pages and pages and i would like to know how can we make container to not being visible to an unregistered user and how to be visible in registered or better to a spesific user.
View 1 Replies
Feb 24, 2011
Let's say I have a rolegroup as follows:
<asp:LoginView ID="lvDoSomeStuff" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="RoleOne,RoleTwo">
<ContentTemplate>
...
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
Is there a way I can make it so that a user must meet RoleOne and RoleTwo to satisfy the RoleGroup? By default, if a user is in either of the two roles, they will be granted access. I know I can do this via the code-behind, but I'd prefer to be able to wrap some content template with this markup instead of having to wrap it in a panel and hide the panel programmatically.
View 1 Replies
Sep 21, 2010
i want to implement asp.net role provider to assign users over my LAN to roles and have my asp.net intranet app implement security based on roles.
i dont want to use VS to manage this with the built in tools but rather hand this off to users to manage themselves. i want an admin folder with a page(s) for admin roles to be able to create/edit roles and manage users in roles... this way an admin can add a domain user (MyDomainUsername) to a role such as ProojectManager or Tester or Developer... and users wont need to contact me for these tasks...
can anyone provide me a link (or some sample code) to some sample i can use to admin roles and users over a LAN in asp.net with c#?
View 1 Replies
Mar 7, 2011
I have a multi level application that I am developing and need to block multiple rows from being joined. I know how to hide one role but I cannot figure out how to hide multiple.
Here is my current code
[Code]....
View 2 Replies
May 17, 2010
Newb question: what is the standard practice for assigning roles to newly signed-on members. Is it usually manual or is there a way of automatically assigning roles. Being completely new to this, I am confronted by the issue of my site having three different roles that new members could fall into, but am unsure about how to assign each a role. I can't imagine having to go through the process manually if I have thousands of members.
View 6 Replies
Jul 23, 2010
I am wanting to use the User Creation Wizard and also be able to select the Role of that user. In this applicaiton. I will be creating or my backup person will be creating our users. We will only have a few users and I want to make it so I can create the user and select there role thru the application.Can I use the User Creation Wizard and add to it the ablity to select the roles perhaps show all my rolles as check boxes and just check the ones I need. Currently I only have 3 my CoOp, MACED, Admin most of these are going to be either CoOp or Maced there will be a couple that have both Admin and Maced roles.
View 3 Replies
Feb 7, 2011
I am writing my first MVC 3 aplication (in ASP.NET) and I don't know how I can(should) display the menu for different users.
My app is created as MVC3 Web Application and the menu look like this:
[Code]....
Now, I want to show another links for user(Projects, Profile) and for admin(Manage Projects, Manage Accounts, Manage news). How I should do that?
View 5 Replies
Jan 31, 2011
I am building a content management system and so far I am trying to get a member's area to work. I figured out the CreateUserWizard and the Login controls. I also used Roles.AddUserToRole(RegisterUser.UserName, "Member"); upon account creation to assign the user the role of a "Member". I have been googling but I havent been able to find a solid way on how to restrict either a directory or a page to make it so that only "Member" users can access it, otherwise redirect to login page. Can anyone give me an idea for this? Also I had a related question, when I go on to the site and I am NOT logged in, what is my default role? is it guest or just null?
View 2 Replies
May 23, 2010
I need to get know how SiteMapProvider.IsAccessibleToUser() works. Built-in XmlSiteMapProvider calls HttpContext.User.IsInRole() which uses System.Security.Principal.GenericPrincipal in case of forms authentication.
Where does the current user gets its roles? Which provider loads this kind of information? I want to overload it and use custom logic.
View 2 Replies
Nov 30, 2010
I want to be able to specify which roles having access to certain controllers in web.config and use it something like this:
[Code]....
..but the compiler says "Error 1 An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type...". How to accomplish this behavior?
View 3 Replies
Apr 3, 2010
I'm developing a web application I want to use the role authentication to control different parts of the website accessibility. But my problem is say I implemented a upload and download functionality on one of the page and I want to have the ability to control a user whether they can either upload or download; or both. So, I'm not exactly sure if the role base authentication can support a user with more than one role to work the way I want it.
View 1 Replies
Sep 24, 2010
I have a pdf file that will be stored in a website and based from roles it will call the certain pdf files. (done with this save pdf inside a folder then call it using sitemap per pdf files according to roles) but I need a search page that will search a given pdf file name based on their roles, they can only see the pdf that is intended for them then via link it will then see all the pdf that was search.
View 1 Replies
Feb 25, 2011
There is a way to get the array of role from the HttpContextBase ?
I'm looking to do a class like that:
public static IList<string> GetUserRoles(this HttpContextBase context)
{
if (context != null)
{
}
// return roles array;
}
View 2 Replies
Aug 11, 2010
I am baffled, I am using a treeview to set the source of an iframe. The web page is being displayed correctly, but User.IsInRole("roleName"), in the code behind, always returns false. The strange thing is User.Identity.Name returns the correct user name. I have tried setting the target of the tree view nodes to "_blank" and to "_self" and still no luck. So, it doesn't appear that the problem is related to the iframe.Before the treeview was added, javascript was used to set the source for the iframe and User.IsInRole returned the correct values.
View 4 Replies
Aug 23, 2010
I am new to MVC and am using MVCContrib and trying to use the Checkboxlist .My requirement is to display list of all available roles on create user page . I have dine as below .
<%=this.CheckBoxList("Roles").Label("Roles:").Options(new MultiSelectList(Roles.GetAllRoles(),"DataTextField","DataValueField"))%>
In this case GetAllRoles method retuns string[] . How can I assign the "DataTextField","DataValueField" to make it work ?
View 7 Replies
Jan 7, 2010
I have used .net login control to authenticate user,i have three types of role ,role1,role2 and role3 and i have users and user have different roles.
now my requirement is like as per loggedin user i want to redirect user on particular page as per role.
for example if loggedin user role is role1 than he will redirect default1.aspx
for example if loggedin user role is role2 than he will redirect default2.aspx
for example if loggedin user role is role3 than he will redirect default3.aspx
and one question if same user may be have more than one role than what should happen???
I got a solution for same than if we are used "loggingin" event than it would be possible but i had placed login control in login view anonymous template because as per my requirement i want that after successfull login user can't see login control on page.thats why i didn't get the login control event on code.
View 6 Replies
Jan 18, 2010
My project has a Guest folder and an admin folder.
Guest has a guest1.aspx page and admin has admin1.aspx page.
Now I am trying to figure out a login control which will check the role of the user and send them to the respective pages accordingly.
The names are not in the database or the active directory...
These names are on the windows 2003 server...
So I need to check from the server if the user exists and what is its role in it.. Suppose there is company which has 10 employees and one administrator.. the company has a server and these employees are on the same domain. So the admin can add that machine to the server or delete it.. now every machine has its username password and domain.. i want my gui to use the same credentials to log into the gui and send them to the respective pages according to the role..
View 2 Replies
Mar 22, 2010
In our system now, we have a class of user and beneath each class, there's a type of user.
Is there a way to setup and use the ASP.Net role provider with this kind of setup?
View 2 Replies
Jul 20, 2010
I have a page using an injected BLL service: a simple service returning a set of objects with a function like this:
public IMyService { List<Foo> All(); }
There is a default implementation for normal users.Now, i need that users in administrative role can view more objects, with another implementation of the service.Where can i configure my page to use the second implementation?
My first solution is to put the dependency to the IUnityContainer in the page, and use it to resolve the dependency:
[Dependency]
public IUnityContainer Container { get; set;}
Page_Init(..) [code].....
it's a ServiceLocator and it's neither scalable neither testable.
View 2 Replies
Sep 7, 2010
I am developing a website in which i am using forms authentication. We have 2 log in pages.one for user another for admin. I added this code into webconfig file for user.
<forms loginUrl="Login.aspx" defaultUrl="Home.aspx" >
I am using this code for user side when user successfully logged in.
FormsAuthentication.RedirectFromLoginPage (UserName.Text, chkPersistCookie.Checked)
I am not using the default user membership database.i have my own data base in sql server 2005 I want same thing for admin,but the default url is Admin.aspx & login url is adminlogin.aspx for admin. How can i assign in web config file for admin?
View 2 Replies
Sep 6, 2010
I am not sure is there any other way to add User for my application othe than using Asp.net Website admistration tool??
View 1 Replies
Mar 24, 2010
I have a section on a page where a user can change their username. This is basically the code for that:
user.UserName = txtNewUserName.Text;
user.Save();
user is a class in my dbml and Save calls SubmitChanges on the data context.The name is changed in the database, so when it calls the following method, it fails because it is trying to get the user with the old username instead of the one that is in the database now.
public override string[] GetRolesForUser(string username)
{
return dc.Users.Where(u => u.UserName== username)
.SingleOrDefault().Roles
.Select(r => r.RoleName).ToArray<string>();
}
View 1 Replies
Feb 20, 2010
i am new to asp.net, i am creating a small website for my college, in that.
Only the admin's can create other users...
Now while using the nw registration wizard, i hav to mention the role also in that page.
View 5 Replies
Jun 10, 2010
can any one tell how to create the roles in asp.net? when ever Admin creates the roles, there it self he should assing the pages,which pages should be open when ever perticular person enters in to the site. When ever Admin wants to assing the Roles,all pages appear in grid view with check box,if he checks that pages,he able to access other wise he couldnot access that page.
View 1 Replies