Microsoft Visual Studio 2013 and Memberships - asp.net

As you know, Microsoft removed ASP.NET Web Configuration Tool in VS2013 and it is a bad downgrade for it. thanks THIS post that shows a way (but difficult) to use ASP.NET Configuration Tool.
so what is the easiest way to define memberships, roles, users, access rules and ...?
ASP.NET Web Configuration Tool was really simple and user friendly.
Any more suggestions would be greatly appreciated.

Microsoft is moving membership system from Membership Provider to ASP.NET Identity.
However, if you want to use Membership Provider there is a new one called ASP.NET Universal Providers.
ASP.NET Universal Providers supports NuGet package, and the package will create the requires membership tags in web.config.

Setting up membership/roles isn't much difficult once you understand the basics. You will love to set things up directly in the web.config, once you start using it.
Check these:
Setting up Membership
Setting up authorization rules

Related

What is the best way to manage ASP.NET Identity roles and membership

Now that Microsoft has removed support for the ASP.NET Web Application Management tool in Visual Studio 2013, what is the best way to manage users and roles in your ASP.NET applications?
I'm starting on a new web app, and instead of building my own system for authentication and role management, I planned on using ASP.NET. However, what is the easiest way to add roles and members without directly editing the database?
I would suggest following the methodology used in the ASP.NET Identity Sample:
https://github.com/rustd/AspnetIdentitySample/tree/master/AspnetIdentitySample/Controllers
They use two Controllers: RolesAdminController and UserAdminController.
Using this scheme would allow for a seeded administrative account to then manage the roles and users of that site.
I suspect you could probably just copy those straight into a new project using the new Identity scheme with very few modifications to work properly. However, I haven't personally attempted doing that part myself.

Customise new ASP.Net Web Security

In previous versions of Visual Studio I have on occasion had a need to change the Membership to my own custom one because of existing user tables and/or existing password policies. To do this I used the Membership Provider and changed accordingly.
I have just started looking at VS 2013 and new projects uses OWIN and ASP.Net Identity which I'm not familiar with yet. Does anyone know the best way to customise these as well in order to use existing tables and override login functions?
This article Migrating an Existing Website from SQL Membership to ASP.NET Identity should get you started.

User management with ASP.NET MVC 4

I am trying to re-learn ASP.NET and building some application, however tutorial seems to be running shorts.
I understand ASP.NET comes now with built in membership which allows users to created and edit, login to users. However, is there a way for me to create a User Controller. From what I have read, its a big no, because it may conflict with the AccountController. Maybe this is wrong, but I would like to be sure first.
Also I understand that I can use the word [Authorize] in a controller ( action, or class ) to limit access to users. However if I provide [Authorize(Roles="Admin")] How can I define the roles to a users? Is there a field that already exists in the membership providing this or do i need to supply a second nuget packages. If its a field from the user, how does it know Roles is the value in the User tables?
You're confusing multiple things. Asp.net is the basic web technology, and there are three technologies that sit on top of that. Webforms, Web Pages, and MVC.
Membership has been a part of asp.net since Version 2, released in 2005. This is nothing new. There has been much written about it over the years.
If you're using MVC, which it seems you are, and you're using MVC4, then the default internet template uses SimpleMembership, which is not compatible with the built-in membership editor in Visual Studio (known as the Web Site Administration Tool or WSaT). This is only compatible with the old SqlMembership database tables, and SimpleMembership does not use those tables.
You can use SqlMembership with MVC4, but you have to configure it to use SqlMembership. Or, you can just not use WSaT and configure your user yourself.
Oh, and don't listen to people that tell you to create custom membership providers. This is the worst advice possible unless you know what you are doing, because it's non-trivial to create secure password hashing techniques. And 99% of people that try (even people that should know better) get it wrong unless they pay very close attention.
Use a provider from a reputable source unless you have VERY good reason not to. And then, check, double check, triple check your hashing code and then have an expert check it.
For Authentication and Authorization in asp.net, have a look at Forms Authentication and Membership Provider (and Role Provider for roles)
A quick search gives this article: Here
have a look at other searches for "Custom Membership Provider"
This also looks interesting: How do I create a custom membership provider for ASP.NET MVC 2?

ASP.NET MVC: Best Way to Enable Different Modes of Authentication?

I'm currently working on an application that will likely be deployed amongst various organizations within my current workplace. I need to develop a testable and properly designed authentication framework so that for each implementation folks can choose to use either Windows Authentication, Forms Authentication, a home-grown Single-SignOn system OR OpenID.
So given ASP.NET MVC (and in particular I'm using the S#arp Architecture framework) how should I go about doing this?
Ideally it would be nice if folks can simply make changes to the web.config file in each case.
Thanks
ASP .NET MVC supports ASP .NET membership provider, making it easier for you to handle Windows/Forms Authentication without any hassle. As long as you specify the required information on the web.config. The default site comes with an example.
For other options of implementation, Kigg has an OpenID implementation which also includes the unit testing code.
I guess that after learning how those work you'll find a way to include your "home-grown Single-SignOn" authentication framework :P
Update:
In order to use the membership provider using your own users table, you must implement a custom provider. The configuration through the web.config will be available anyways, but you'll need to create a class which implements the MembershipProvider abstract class.
Here's a link to a video and some source code explaining how to achieve this.

What to use for membership in ASP.NET

I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly).
Now I'm preparing for MVC (ASP.NET MVC or Monorail based) project, and I'm thinking - is there a better way to handle users? Have them log in/log out, keep certain parts of the site available to certain users (like logged in users, or something similar to "share this with friends" feature of many social networking sites, where you can designate users that have access to certain things.
How best to acheave this in the way that will scale well?
I guess, I wasn't clear on that. To rephrase my question:
Would you use standard ASP.NET membership provider for a web-facing app, or something else (what)?
The Membership Provider in ASP.NET is very handy and extensible. It's simple to use the "off the shelf" features like Active Directory, SQL Server, and OpenLDAP. The main advantage is the ability to not reinvent the wheel. If your needs are more nuanced than that you can build your own provider by extending overriding the methods that the ASP.NET controls use.
I am building my own Custom Membership Provider for an e-commerce website. Below are some resources for more information on Membership Providers. I asked myself the same questions when I start that project.
These resources were useful to me for my decision:
Writing a Custom Membership Provider - DevX
How do I create a Customer Membership Provider - ASP.NET, Microsoft
Implementing a Membership Provider - MSDN
Examining ASP.NET 2.0's Membership, Roles, and Profile - 4GuysFromRolla
Create Custom Membership Provider for ASP.NET Website Security - David Hayden
Setting up a Custom Membership Provider - Channel 9
I personally don't think there is a need to use something other than the builtin stuff unless you either want to abuse yourself or your needs are impossible to satisfy by the builtin functionality.
Have you considered using ActiveDirectory for this? Or, perhaps, OpenLDAP? You can manage each user's groups, permissions, 'authority', and so on.
keep certain parts of the site available to certain users (like logged
in users, or something similar to "share this with friends" feature of
many social networking sites
I guess you must custom code your thing.
I also do not like the asp.net Membership and custom code my membership needs...
A nice membership provider is a really missing thing in asp.net side...
It depends.
If it's an internal application, Active Directory or OpenLDAP might be the way to go.
If it's a public application, I suggest to look at aspnet_regsql. You will be able to setup a database with Authentication in no time.

Resources