SecurityGuard is a NuGet package that quickly installs a complete UI for managing the ASP.NET Membership system on your ASP.NET MVC 3 application.
In this video I'll demonstrate how to install the ASP.NET Membership system using my other NuGet package, MvcInstaller, and then install SecurityGuard to actually manage the membership system. The entire process takes only a few minutes to install and configure.
Story Details for videos
SecurityGuard - Video for NuGet Package
Author:
Version:
Views:
4525
Date Posted:
8/31/2011 8:21:26 PM
Date Updated:
8/31/2011 8:21:26 PM
Rating:
Running Time:
25:18 minutes
Framework:
Platform:
Programming Language:
Technologies:
Tags:
Demo site:
Home Page:
Share:
Downloads:
MP4
Comments
User Name:
(Required)
Email:
(Required)


Great video! Looking forward to implementing and glad I don't have to code up yet another membership/roles module for my client!
Thanks!
WhenI click onlogout
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidOperationException: To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".
@krzysiekok - hi, this is an easy error to fix. It's covered in the companion article for SecurityGuard, under the "LoginPartial Updates" heading.
But in short, the error is due to the fact that the LogOff link is still pointing to "Account/LogOff" when it should be pointing to "SGAccount/LogOff". But there's more than just changing the link reference, that's why you should look at the article for the complete solution. The LogOff and other features like this now require the AntiForgeryToken, so a form needs to be used to Log off.
I hope this helps.
Ohh,
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" }))
@using (Html.BeginForm("LogOff", "SGAccount", FormMethod.Post, new { id = "logoutForm" }))
Thanks!
Nice work!
How to add custom fields to user's profile e.g. address, city, .... ?
Thanks for quick answer!
I'am considering to create new class "MembershipsProfiles" which will contain "UserId" from "Memberships" as a relationship. The other attributes will be custom data for user: city, address,...
Please for your advice about that and if it is possible how to implement UI.
Also, could I use EF for "MembershipsProfiles"?
Thanks!
@banek - to create your own custom Profile class you should probably look at these articles. They give more information on how to manage profiles within your application.
Jon Galloway's article
Scott Hanselman's article
Once you create the class, then you create a new view and actions to use your new custom profile class.
I hope this helps.
Hi King, excellent video and brilliant security package!
Got it all working on my mvc 4 application, i had to disable the search function in the Membership\index.cshtml file though was throwing an error saying 'The call is ambiguous' for the Model.SearchTerm
@jayjay - are you using the latest version of SecurityGuard for Mvc 4? I've tested it on many applications and I don't get that error, but I'll look into it.
What was the search process you used? Filter by: View All, Username, Email?
Thanks for the video
sorry but i have an error when i run MvcInstaller i have the error Could not find a part of the path
sorry, i am a new user of .net technology
@RV - to fix this, just create a "Reset" folder inside the App_Data folder and the error will go away. This folder allows you to add your own SQL scripts to reset any database configurations in the event that the installation fails the first time. There's more information about how to create your SQL scripts in the article for Mvc 3 applciations. I'll make this clearer in the documentation.
http://www.mvccentral.net/s/44
Also, this is the SecurityGuard video story, not the MvcInstaller story. :^)
Hi,
Really nice video. I have installed securityguard and i am trying to use it. But i am getting error at @user.IsinRole("SecurityGuard")
It complains as object reference being not set.
Help on this is appreciated.
Hi,
Appreciate your response.
Actually i have sent another question yesterday with some details and write up. I could see that yesterday, any ways that fine.
Yes you are right, thats with if statment i guess.
Another question i had is my membership provider is MongoDB custom provider, what is the best way to take advantage of your security guard with custom provider.
Thanks.
@praveen - as I mentioned in my other response in the SecurityGuard post, SecurityGuard was not built to be used with MondoDb or any other "no sql" provider. At the moment it's meant to be used with SQL Server and the ASP.NET Membership system only.
You could try to have two databases, one as SQL Server with the Membership system, and the other as MongoDB. You would need two connection strings in your web.config. You could see if that would work, otherwise I don't have any suggestions.
Can you use SecurityGuard without it's LogOn screens? I would prefer to implement my own Log on and authentication routines. I'm only interested in the user management aspect of SecurityGuard.
Also, do you have to use a SecurityGuard role? Can I create my own?
@kinstephen - you have the complete source code, so you can modify it all you want. The actual source code is also up on github, if you go to the other SecurityGuard for MVC4 article, you'll see the link to the repository.
The only reason to use the SecurityGuard Role is to be able to differentiate who gets to see that navigation item to the SecurityGuard Dashboard. You can do anything else that you want, this was just an easy out-of-the-box way of saying, "this Role is the only one that gets to view the SecurityGuard Dashboard."
I hope that answers your questions.