.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

[PrincipalPermission(SecurityAction.Demand, Role = @"MyDomain\MyGroup")]

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :WCF

I'm trying to create the simplest possible scenario to test this in VS2010 on my local machine.

[PrincipalPermission(SecurityAction.Demand, Role = @"MyDomain\MyGroup")]
public string GetData(int value)
    return string.Format("You entered: {0}", value);

My basic issue is that I'm always getting denied. 

System.ServiceModel.Security.SecurityAccessDeniedException, even though I'm a member of the group specified above.

I created the out-of-the-box WCF service, and added the attribute as shown above on the GetData method.

I created a new console program in the same solution, and did an "Add Service Reference" to the Cassini reference:  http://localhost:4172/Service1.svc

The app.config of the console program as a result of this used basicHttpBinding (shown below).  According to this article, I was expecting to see WSHttpBinding: http://www.codeproject.com/KB/WCF/HttpBinding.aspx


                <binding name="BasicHttpBinding_IService1" closeT

View Complete Post

More Related Resource Links

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



Test-Driven Design: Using Mocks And Tests To Design Role-Based Objects


Use Test-Driven Development with mock objects to design object oriented code in terms of roles and responsibilities, not categorization of objects into class hierarchies.

Isaiah Perumalla

MSDN Magazine June 2009

Patterns in Practice: Object Role Stereotypes


Object role stereotypes can help you better understand and clarify the responsibilities of the objects in your application.

Jeremy Miller

MSDN Magazine August 2008

Authorize It: Use Role-Based Security in Your Middle Tier .NET Apps with Authorization Manager


Authorization Manager in Windows Server 2003 represents a significant improvement in the administration of role-based security, making it more scalable, flexible, and easier to implement. Using Authorization Manager, you can define roles and the tasks those roles can perform. You can nest roles to inherit characteristics from other roles, and you can define application groups. In addition, Authorization Manager lets you use scripts to modify permissions dynamically, and it allows you to wrap your security logic in a security policy that can be stored in Active Directory. Authorization Manager also includes an easy-to-use API for running access checks. The author discusses all of these topics and demonstrates them with a working sample.

Keith Brown

MSDN Magazine November 2003

Talking To.: Don Box Discusses Web Services and His New Role at Microsoft


Don Box has long been the preeminent expert on COM, as well as one of the creators of the SOAP protocol. He has written numerous books and articles including Essential COM (Addison-Wesley, 1997) and Essential .

MSDN Magazine December 2002

Security: Unify the Role-Based Security Models for Enterprise and Application Domains with .NET


Role-based security allows administrators to assign access permissions to users based on the roles they play rather than on their individual identities. These privileges can be used to control access to objects and methods, and are easier to identify and maintain than user-based security. The .NET Framework provides two role-based security models, which are exposed as two namespaces: System.Enterprise-Services and System.Security.Permissions. Presented here is a comparison of the two options and a discussion of when each is the right choice. The author also demonstrates the process involved in setting up access security and discusses role memberships.

Juval Lowy

MSDN Magazine May 2002

Extending Role/Membership


Given an organization site, here is what we need to accomplish:

  1. Administer Role/Membership completely on specific pages of the remotely hosted site instead of using a local site within Visual Studio.
  2. Create and add region group, city group or other groups in addition to the basic user group. How can the new groups be stored and administered?
  3. After users login the 1st time, their Role/Membership are saved so that they will be redirected to their own designated page upon future login. Are we going to use cookies and/or tables to store related data?

Please advise how to best implement the above with samples and/or tutorials.

Thanks much in advance.

require guideline for 'Role-based authentication/authorization'



In my asp.net website in VS-2005 with SQL-Server 2005 as db, I need to implement role-based Authentication/Authorization.

I am familiar to the practises used in role-based authentication..as I have previously worked on projects that used this method. However, my project lead used to design the database. Now I have an existing website where authentication has been set to anonymous by setting 'allow users="?"' in the authentication tags in web.config.

If I use the createUserWizard control and use the Membership.creatUser(.....) method in code behind will the asp.net security tables, like users, roles, userinrole etc get created on its own? Can anyone please give the proper steps on how to acheive this?

Need help with setting up SQL Server 2008 for role/user management


I've posted my problem in a few other categories.  Sorry for that.  I didn't see the security category until now.

I'm trying to use ASP.NET's built-in role/user management for a couple ASP.NET MVC 2 sites.  I'm using the MVCMusicStore as my guide.  I click on the Configuration Tool as the tutorial suggests, which launches the site administration page.  Unfortunately when I click on the security tab, I get an error that it cannot connect to the data store.  Attempting to test the AspNetSqlProvider gives me a similar error.

I've run the aspnet_regsql program as the error message suggested, and I have a role/user management database ready to go on the server.  The proper tables are constructed, and all that.  The configuration tool still doesn't see the data store.

As a test, I ran the MVCMusicStore demo in the debugger.  Its role/user management functionality worked.  I was able to add myself as a customer, and add/remove items from my cart with no errors or exceptions.  However, when I attempted to access its security tab in the configuration tool, I received the same error as I get for my own project.  How is it possible that role/user management works, but the configuration tool cannot change its settings?

Any suggestions on how I can get the configuration t

what is role of object properties when using client side validations ?


I have been using properties and have idea that using properties with private fields we can implement validations and buisness rules in them.

But I am just thinking asp.net client side validation controls provide good strength and they provide good user experience as well. They can be used for any type of validation (using regular expression) on client side and their re-use is possible on server side. When validation controls are a must and they are powerful; is making properties not just wastage of time ?

Is there still some use of properties ? Please guide me.


SSRS Role ID and TaskMask

Hello, I need to find out who has access to what on SSRS.  From the User table, I can query something like the following.    Questions: 1) What is Role ID?  Is this a 1:1 map to a user? 2) What is TaskMask?  Is this a 1:1 map to a specific item (ie folder/report)? 3) How do I find out the mapping (ie the actual user name or folder/report name)? RoleID RoleName Description TaskMask RoleFlags 30429381-0F4C-45E9-9136-AB4FE71CCD71 View Folder View folder structure and reports available (incl report definition) but can't run reports 0000001000000000 0 DF7F6687-DF4E-4D2A-B1A8-B0917EA4E82C Browser May view folders, reports and subscribe to reports. 0010101001000100 0 DF7F6687-DF4E-4D2A-B1A8-B0917EA4E82C Browser May view folders, reports and subscribe to reports. 0010101001000100 0 30429381-0F4C-45E9-9136-AB4FE71CCD71 View Folder View folder structure and reports available (incl report definition) but can't run reports 0000001000000000 0 DF7F6687-DF4E-4D2A-B1A8-B0917EA4E82C Browser May view folders, reports and subscribe to reports. 0010101001000100 0 DF7F6687-DF4E-4D2A-B1A8-B0917EA4E82C Browser May view folders, reports and subscribe to reports.

How to setup the premission by using role and schema in MS SQL 2005

At MS SQL 2000, it has two groups of users - u1 & u2 which have the difference permissions to the tables & stored procedures.  It setups 2 roles - r1 & r2 to define two sets permissions and grants the permission (select, exec, ...) to these 2 roles - r1 & r2 in the defined Tables and Stored Procedures.  After upgrade from MS SQL 2000 to MS SQL 2005, it has the schema & role.  How to setup the role & schema to meet my requirement?  

Getting filtered data from Role based SSAS security

Hi everyone,I've got a heap of reports that are based on various SSAS cubes. I have roles defined on these cubes that restrict data via certain dimensions. Question is, will these restrictions filter through to the report...ie, if I have a sales person restricted in the SSAS cube to only see sales against their territory (restricted in the Territory dimension), when they run the report will it filter the result based on their SSAS credentials and only show the data they have access to (even though the SSRS report has no direct filters or parameters applied)?Cheers for any help!!

MDX to read members from "restricted access" role

Is it possible to read list of members from "restricted access" roles? I want an MDX so we can create an exception report for maintance purposes to match this list with some other list. I only need to list what I see when I open "resticted access" role - domains with user names. thank you!

Can I have a listview load on demand instead of always loading when I use the DATASourceID without h

I know that I can load on demand using the Datasource property instead of the datasourceID.  Is there a way to turn on and off DatasourceID so that it only loads on command with codebehind, yet leave everything else the same with the DatasourceID 

Membership & role management in asp.net..

hi..am switched from windows application to web application i want full application  of Membership & role management (Dynamicaly create User, role,members .....)if available please inform me or give me information how to create application steps
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend