MVC5 to use custom membership or my own implemenation? - asp.net-membership

I'm starting a new project and intending(I actually started implementation) to use MVC 5 and most recent microsoft technologies. In my DB, I have my own table to manage user accounts and storing passwords and I have no problem or complexity doing that.
But(and there always but), most tutorials I see on MVC use .NET Membership. Every tutorial I read to learn about the new fetures is using it. This gives me a feeling that I should too be using it or at least write a custom implementation of it.
Am I looking to it wrongly? Am I missing something here? Do I need to take the development process little bit slower?
I really confused and I'm not sure which path to take specially I'm still at the start of my project.

I would suggest using Asp Identity 2 which replaces the old Asp Membership, with the account functionality scaffolded when you create a new MVC 5 Web application. It gives you heaps of functionality straight out of the box.
Of course, it depends on your requirements, but this is a pretty robust way to get started. It easily allows you to intergrate other OAuth providers like Facebook etc.
Here are some helpful resources:
http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx
http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx
http://msdn.microsoft.com/en-us/data/jj200620.aspx
You can map your current user table to the IdentityUser if they follow the same structure.
http://coderdiaries.com/2014/01/29/custom-table-names-for-asp-net-identity/

Related

What is the purpose of adding services.AddMvc() in the ConfigureServices method in mvc 6?

Why is not enought to just add app.UseMvc() in the Configuration method in a mvc6 application? why it is also necessary to add the services.AddMvc() in the ConfigureServices method? and where can I find more info about this?
Thank you.
In this new ASP.NET 5 world there are two primary aspects of app development.
Dependency Injection. Aka what services are going to be required to run our application?
The application/request pipeline. Essentially the way we answer the question of "What to do when a request hits the server".
Due to these two primary concerns there then happens to be two mechanisms for tying into the system.
First, UseMVC is the way your application can say I want MVC to take a part in the request handling stage at "this" point. It's essentially a shortcut to an MVC specific middleware.
Second, AddMvc is the way your application says that you want the MVC services available to the system (needed in order for UseMvc) to work correctly. Therefore, if you were to try and do UseMvc without adding the corresponding MVC services the call would throw. Note that this adds the appropriate MVC services to the DI container.
Hopefully this answered your questions, for more information on it you can check out http://www.asp.net/vnext for more general information. For something more specific/video I did a talk a while back at Orchard conference where I go over several of the core pieces https://www.youtube.com/watch?v=kqgIByKn9Wk
Note: I gave the talk a while back, some concepts are outdated/may have changed but the core concepts are the same.

ASP.Net MVC 4 Global properties Like Profile Settings

I'm looking to have something like a profile provider in my ASP.NET MVC 4 that is using SimpleMembership. Correct me if I'm wrong by I don't think they've included the profileProviders into the simpleMembership yet. (I was not able to find an example of it anyways)
What I need is to be able to store user specific information (Email, Account number, etc...) that are needed often and easily retrieve them from anywhere in the application (views, controllers etc)
How can I do this? what is the best practice? I'm quite new to the platform and am learning everyday so sorry if this question has been asked before. I was not able to find it.
If you're new to the framework you should probably start reading up on some of the more basic features before you go slightly deeper into things like role providers etc. A good place to start is the ASP.NET MVC tutorials. There's lots of other good tutorials that you'll be able to find with a search.
The MVC4 internet template provides you with a UserProfile model out of the box that integrates Simple Membership. The UserProfile class has properties for common user attributes such as username, email, password etc.
You can add more attributes to the model to meet your requiurements. A tutorial on how to do so can be found here. Look for the section where the author explains adding Custom User Properties. This tutorial also touches on Simple Membership.

Getting own EF 4.1 Code First classes to work with .NET Membership

I am working on a simple web application that is built with EF 4.1 Code First and MVC3. My Domain Model sits in a project outside the MVC3 project.
I have gotten to the stage where my web application is more or less complete. However right now, my application doesn't have any form of authorization or authentication. So a regular user can get to Actions and Controllers that only an Admin is suppose to have access to.
My question is, how do I get my web application to work with the .NET Membership ? Because I am aware that the .NET Membership has many database tables of its own !
My knowledge is fairly limited, thus any clear, easy to follow responses would be greatly appreciated.
After the Membership is set up, I know my way around applying Authentication and Authorization to Actions and Controllers.
Thank You.
Go into your C:\Windows\Microsoft.NET\Framework\v2.xx or v4.xx\ and execute aspnet_regsql, this will launch a wizard that allows you to choose your database and it will add the stored procs and tables to allow membership to function.
Then you run the ASP.NET configuration wizard (the little toolbox icon at the top of your solution explorer) and then configure your roles and accounts. See this page and skip to the Configuring the website for membership and roles section.
ASP.Net membership is actually kinda interesting and frustrating to an extent. To you run a tool called aspnet_regsql.exe found in your Windows\Microsoft.net\Framework folder which generates all of the necessary tables to get it running. Next move onto your Web.config file. If you started with your basic ASP.NET MVC 3 template then you should have a <connectionStrings> entry under the name "ApplicationServices". Change that to your database connection string. This is what the membership provider uses to hook everything up. If you look through the rest of the config file there should be sections for <authentication>, <membership>, <profile>, and <roleManager>. These deal with the various sections and settings that the ASP.Net user management is broken into.
At this point everything should be hooked up. If you select your project in the solution explorer, a little red hammer icon should appear. This is the ASP.NET configuration manager. You can use this to set up different profiles and manage different users.
Now this stuff won't be connected to your EF4.1 code first stuff at all. Instead, you can interact with your membership provider through static classes Membership and Roles. If you take a look at the AccountController on a default ASP.Net MVC 3 Internet application template it will give you a good idea how it works.
After working with this stuff for several months, I found it much easier to basically write your own. Tying things together eventually becomes a huge pain and there is a whole lot of extras that the membership provider gives you that is unnecessary for small applications.

MVC 3, Entity Framework 4.x, Database First, Desperation

VS2010 Pro + SqlServer Express.
Having been dropped into ASP.NET MVC 3 with no guidance but the web (2 books on order), I can't even get off the ground.
The MVC itself I get. Not a problem.
PHP, Ruby, and even ghastly WebForms firmly tucked into my toolbelt, with a long history of C++ QT client-server development before that.
Tying ASP.NET MVC 3 to a database using EF4 ORM is killing me.
The goals:
Use database modeled by DBA. I can specify all naming conventions, but code first is not an option!
Import to EDMX. This will be regularly updated using VS tools from the DBA's DB, never edited directly.
Generate partial classes from EDMX, for use as model. This will regularly be updated using VS tools, never edited directly.
Use 'buddy' to extend above model class with code as the Controllers/Views need.
Intuitively use the resulting model, pass it to the view, retrieve posts into it for insert/save, etc...
I've seen and read so many blogs, forum posts, walkthroughs, and stack overflow posts regarding this very use case.
I even tried riding the magic unicorn, followed by the latest 4.2beta1 with DbContext generators.
But can't get off the ground.
I follow instructions, but just not understanding how to do anything with it.
What conventions does the 'buddy' require (if any)? How do I use it? How do I get data with it? How do I write data?
Every example looks different. MVC guides are always focused on the UI side. EF guides don't cover usage in the MVC.
These are basic questions, and I'm feeling like the most incompetent idiot in the WWW right now.
Is anyone out there currently using MVC3 & EF4.x in the way I describe above?
This video is a good starting resource. Its a video of a guy creating an app from scratch that uses entity and a sql database (though he makes the db in the video, its still good for seeing some basics in action). You can see how he pulls data from the database, displays it on the page, and saves changes back to the database.
The first question I would ask is why are you stuck on using EF as an ORM or even insisting an ORM at all? I'd choose tools to suit the job here, especially given the constraints of the data layer.
Buddy classes were a concept invented in a day when the main .NET ORMs had no code-first option as ORM-encumbered class instances really don't behave well under things like model binding. Nevermind you could not decorate them with the DataAnnotations one used to indicate fields were required. Typically, the technical requirement is to use [MetadataType] attributes to tie your buddies to your models and perhaps something like AutoMapper to map data to and fro.
All that said, as a guy who has a few apps with lots of buddies and lots of automapping going on, you might want to think otherwise -- it is a bit of a maintenance nightmare. I'm living it.
There are some really good getting-started videos and tutorials right on ASP.NET MVC's site. The "Model (Data)" section is Entity Framework focused and touches on hot/trending topics like Repositories and Units Of Work.

Codeigniter admin/auth system?

I'm starting a new project with codeigniter, and I'd like to start on a system that's already built so I can reduce the time of development.
Is there a good system that handles user authentication along with an admin interface to manage users that can be easily expanded to a web-app?
If this is too vague, I can expand
This thread here appears to have some answers
But the question was more about libraries. Either way, implementing some of the things on that thread would save you time.
You're looking for is a Content Management System (CMS).
There are a few ones out there that use Codeigniter as a framework for their CMS.
Edit: Even if you can't find a boilerplate CMS that you like, you can google about CMS's to design a simple one of your own as there's LOTS of tutorials and information about requirements and such when you know the term CMS.
I recommend Redux Auth for CodeIgniter. It comes with an example implementation, and can easily be used to manage user authentication for your CodeIgniter site. I just implemented Beta2 with the latest version of CodeIgniter, so while it's not actively updated, it still works with the latest build.
I'm using Bonfire as default admin interface.
I've just started looking into Bonfire:
Bonfire helps you build CodeIgniter-based PHP web applications even faster, by providing powerful tools and a beautiful interface you won't be ashamed to show your client.
Ready to customize Admin Interface.
User Management with Role-Based Access Control.
Fully Modular codebase.
Built around HMVC.
Database backup, migration, and maintenance.
Powerful, parent/child capable theme engine.
Simple Email Queue to keep your ISP happy.
UI-based module builder.
Looks good at first glance!

Resources