Accessing ASP.Net Membership in a Console Application? - asp.net

I'm writing a simple utility console app to add new users, etc, to an SQL Server Membership Store.
The issue I'm running into is that I can't seem to add a reference to System.Web, so I can't access the Membership stuff. How does one go about doing this?
NOTE: I've found a few questions on stackoverflow that seem similar, but the answers revolved around MVC, and after attempting the suggested answers, the problem still remains.
Edit:
Oded helped lead me to the answer. By default it was filtering by the "client profile", which doesn't have System.Web available. I had to retarget to .Net 4 instead of .Net 4 client profile as described in the following MSDN article.
http://msdn.microsoft.com/en-us/library/bb398202.aspx

Make sure you are targeting the full framework in your project (right click on the project node and select Properties) - In the Application tab there is a drop down for Target Framework.
Make sure this does not use a client profile.

What exactly prevents to you to add reference to System.Web in a console application? Just add appropriate reference via references management in VS. After that you should configure your application with App.config and work with Membership services as in web applcation

Related

Asp.NET and Asp.NET Core Identity model over the same database

I have two applications, one in asp.net and the other in asp.net core. I want to share a common database, as well as the same login. Ie, a user can register via asp.net application, and then their identity will be shared with asp.net core application.
Is this possible? I notice that each have their own identity models, and I am looking for a way of sharing this, ie. some documentation to resolve this.
Looking for:
- Is this possible?
- Documentation and more information on implementation (how to)
I am resolving by use of Identity Server, which both applications will hook into. Will just take a bit of re-jigging.

Setting up equivalent of SQLMembershipProvider for ASP.NET vNext

How do I go about setting up an equivalent of a SQLMembershipProvider for individual account authentication for a web app built using ASP.NET vNext. Based on what I am reading, the authentication framework has changed. I would appreciate if you can point me to some reading material on this.
Never mind my question. My SQL Server Explorer in VS 2015 RC had some refresh issues and so I was unable to see the new database right away. In any event, the following link describes how to do it:
Using Identity in ASP.NET vNext

What is the relationship between Oracle.Web and Oracle.DataAccess in-re Asp.Net Forms Auth?

I'm using oracle asp.net Forms Auth in my web app. The asp.net Membership/Role/Profile provider classes use Oracle.web.dll, and the connection string for these use Oracle.DataAccess.dll.
Now I want to change to Oracle.ManagedDataAccess.dll for the main application's data connection.
I made this change, and the app's main data connections work fine. However when any of the Forms Membership/Role/Profile methods are called, I get errors saying "Failed to load Oracle.DataAccess.dll".
I pointed the Forms Auth connections strings to a string using the Managed provider, but the Membership/Role/Profile parts seem to rely on Oracle.Web, which somehow looks for Oracle.DataAccess instead of the Oracle.ManagedDataAccess.
Can anyone shed light on this please?
Thanks,
--Jim
I ran into a similar problem and used Reflector to check references.
Yes, Oracle.Web.dll references Oracle.DataAccess.dll which further references OCI. Since OCI different for 64bit and 32bit one actually needs to install the appropriate Oracle client.
Hope that there will be a Oracle.Web version, that relies on Oracle.ManagedDataAcccess.dll soon.
The advantage of thru the use of oracle.manageddataaccess is kind of lost if one relies on profiles or membership providers.

Microsoft Visual Studio 2013 and Memberships

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

Silverlight/.Net RIA Services - Authorization Working Sample?

I have followed numerous tutorials and walkthroughs/blogs about the capabilities that Ria Services brings to the table when using Silverlight with ASP.Net. Essentially I am looking for a live working example of the authorization functionality that Ria Services can apparently take hold of from ASP.Net. (Even better if it works with ASP.NET MVC too)
Example of failed to work Ria Services authorization implementation
Navigate to the live demo link on this page....fails
This one may work however I couldn't get it to work on my office computer(strange setup that seems to break code for no reason)
Check here: enter link description here. There is a bunch of posts giving samples. It not exactly what you want but has a walk-through for setting up full authorization.
Brad Abrams has some good information. Also note that the new "Silverlight Business Application" template in the Visual Studio -> New Project dialog has authentication set up already where you can mess around with it without having to figure out how to set it up first.
http://blogs.msdn.com/brada/archive/2009/10/05/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-part-26-authentication-and-personalization.aspx
C# Silverlight with RIA Services Authentication
Most likely you haven't configured your environment yet. In the machine.config file for the framework version in use, you will find LocalSqlServer defined. You should edit this definition to point at the SQL Server serving up the aspnetdb database that you want to use (and if you don't have one then start by setting up that).
Machine.config is generally in c:\windows\microsoft.net\framework\v2.something\config
For development you have to configure this in the workstation machine.config to make the debugger's webserver use your production authentication database. For production you have to do the same configuration on the production webserver.
There are different paths for 64 and 32 bit framework instances, and if like me you have 32 and 64 bit editions of version 2, 3, 3.5 and 4 then you have eight "root" configuration files. If you hunt them all down and set all of them it will save untold confusion later.
This is from my blog last october:
The Business Application Template for Silverlight comes with a login and register pages. It is very easy to connect these to a ASPNETDB.mdf.
Just add a LocalSqlServer connection string to your web.config file. For example, here is what I use to connect to Sql Server.
It’s almost too easy!
If you are using SqlExpress on your dev machine, it gets even easier. You don’t have to do anything. Just create a new Silverlight Business App and fire it up. Go to the log-on page and register. It will be slow, but in the background, your ASPNETDB was just created and attached, and you will be logged in. If you then look in the Web.config file, you won’t see a connection string anywhere, as the defaults are used for this piece of magic. Of course, a real world connection is going to need it’s own connection string like the above.
Greg

Resources