Software Engineer Problem Solver

Leo Reading

One Moment, Please...

Find My Articles

Share This Page

B l o g


Leo Reading

Software Engineer and Problem Solver From the USA

Download Resume

My Blog A collection of technical and non-technical mishaps, achievements and stories.


Delay In Development

I had put a decent amount of time and effort into creating this website, but unfortunately it is still seriously lacking in the content department.  While I've been meaning to update it, I've been spending every free moment I have working on a super top-secret project that I will be announcing soon.  If you look through my other posts, you can probably guess that it involves a movile app.  The other aspect of it is a fully functioning website to help support it.


In the past three weeks, I feel like I've learned more than I have in the 6 months prior!  I did not have much, if any, experience with Aspnet Forms authentication until now.  One of the most useful features is the built-in Role manager.  Some of the most useful functions that I have found:


using System.Web.Security;               // You need this reference to use the roles manager



public void foo(String UserName)


    // Determine if a role exists

    if (!Roles.RoleExists("rolename"))


         Role.CreateRole("rolename");                            // Create the role

    } // end if role does not exist


    // Check if a user is currently in a given role

    if (!Roles.IsUserInRole("username", "rolename"))


        Roles.AddUserToRole("username", "rolename");        // Add a specific user to a specific role

    } // end if user is not in role


    // Check if the user is in a role to remove the user from the role

    if (Roles.IsUserInRole("username", "rolename"))


        Roles.RemoveUserFromRole("username", "rolename");

    } // end if user is in role

} // end foo

As much as I tend to bark at Microsoft, they really could not have made it any easier on us developers.  Additionally, it's super easy to extend the Authorization Attribute class to handle unauthorized errors for specific roles, users, etc.

Leo Reading

Leo Reading is a US based software engineer and problem solver. Known as a jack of all trades and master of few, Leo is constantly learning new technology and expanding his understanding of all things 'nerd'

You Might Also Like

Dynamic Robots.Txt Generator in MVC5 Application

A robots.txt file is important because it tells search engine crawlers what they should and should not crawl.  Unfortunately, they don't always listen, but we should take advantage of the ones that do!  In today's world, websites aren't simply a collection of static pages:  There is ever-changing and new content being posted, and wha...

New Website

Facebook and Twitter are a great place to share personal thoughts, pictures, etc with your friends and family.  A big part of who I am is my inner nerd.  I wanted a place to share this part of me with the world.  I've begun development on this site so that I can do just that.  I plan to share some of the technological str...

One Moment, Please