Jeff Garoutte

c# .net and anything else that happens across my desk

The Dummy Provider: Testing membership and roles

Asp.net has a wonderful system built in for handling user accounts and roles. The administration interface is encapsulated in a separate web site that can be accessed from within Visual Studio but it is difficult to integrate into the site.  This often leads to building a new user administration area in each site.  The problem I have with this is going into the data store and deleting the incomplete test data and not having "known good" data for testing. In the past, I have talked about... [More]
Posted: Nov 04 2008, 23:32 by jeff | Comments (1) RSS comment feed |
Filed under: Providers | Unit testing
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

WebService Documentation: Using a custom template

Web Services: they are an easy way to make information accessible or use information from some other site.  For example, weather.gov's wsdl.  The beauty of web services is that not all web services are .net and we don't have to care.  Any web service that adheres to the w3's standards and that provides a wsdl we can easily use in asp.net.  In order to help people understand how to consume the service; asp.net even gives us a nice page of generated documentation when someone opens the asm... [More]

The DropDownList, the DataBind and the Missing Value

I sat there and blinked at the ArgumentOutOfRangeException.  It was just a DropDownList that had the selected value data bound inside a FormView.  How can we prevent this from happening?  I did a little digging on how to handle this odd "spot" and I found this article on a subclass of the DropDownList control.  It is an interesting article, and I almost went this route but it has a draw back I did not like.  The articles solution is to add the missing value to the DropDown... [More]

Reflecting your assemblies in an ASP.Net web site

It never fails.  You need to reflect through all of the assemblies in you web site and you find that the reflection is missing some of the classes.  Asp.net is smart and it does not load a given assembly until it is needed.  So how can you reflect through all of the assemblies in your web site?  Well first, you don't.  Odds are you do not need to reflect through the System and Microsoft assemblies.  What you need is a list of the custom assemblies in your web site; Once you hav... [More]
Posted: May 29 2008, 02:45 by jeff | Comments (0) RSS comment feed |
Filed under: Reflection
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Extending the ASP.Net Security model to use rights : Part Four - RightPermission

The RightPermission works in the background.  Out of sight, out of mind and easily forgotten.  But it performs the "hard" work of securing the code.  The RightPermission clips in at just over 300 lines of code.  If you have not already read Part one - IPrincipal, Part two - IHttpModule and Part three - Attributes go back and take a look; We'll wait for you. First, I am going to give you all the code for the RightPermission and I will cover each method separately.  using System; usi... [More]
Posted: May 28 2008, 02:56 by jeff | Comments (0) RSS comment feed |
Filed under: Security
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Extending the ASP.Net Security model to use rights : Part Three - Attributes

Part Three- Attributes.  Now that we have a Principal object with rights loaded as the current requests user we can begin assigning security to code by the users rights as well as their role membership.  The objective here was to be able to tag code to require a right and assign that right to a role.  Any user within the role would have the right and be able to execute the code.  We have everything in place to do this, except the Attributes. Before e dive into Attributes let me recap wh... [More]
Posted: May 27 2008, 01:17 by jeff | Comments (1) RSS comment feed |
Filed under: Security
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Extending the ASP.Net Security model to use rights : Part two - the IHttpModule

In part one - IPrincipal, I talked about the right and IPrincipal objects needed to add "right" based security to asp.net applications in addition to role based security. There are a few things we need to do to get ready to build the IHttpModule.  First we need something to give us a list of rights for a user.  To do this we will create a quick "RightManager" class.  We will create a static method "GetRightsByUserName" to return a list of Right objects for a gi... [More]
Posted: May 23 2008, 02:44 by jeff | Comments (0) RSS comment feed |
Filed under: Security
Social Bookmarks: E-mail | Kick it! | DZone it! | del.icio.us

Extending the ASP.Net Security model to use rights : Part one - IPrincipal

Every now and again I find myself disappointed in the asp.net security model.  The ability to assign roles is useful but if a role changes and I have implemented code security by role I now have to alter my PrincipalAttributes.  That isn't a huge issue, but I am not of a fan of recompiling my code because the of a minor change when I could secure the code by a right and assign a right to a role in a data store. The first thing we need is a right using System; namespace ObjectHelpDesk.Securi... [More]