ASP.NET Membership/Role providers for Postgres? - asp.net-mvc

I am creating an MVC site and would like to use the built in Membership and Roles for .Net.
I'm using the the .Net Data Provider for Postgresql (Npgsql), but am having trouble defining the membership defaultProvider and Postgresql connection string to connect to my local database.
Can anyone help?

I have not verified this, but will be using it in a project soon. Hopefully I will have more info to follow, and it will "just work" :)
http://code.google.com/p/pgsqlprovider/
Hoping to use this software stack
Windows Server 2008
PostgreSQL
PostGIS
Castle ActiveRecord
NHibernate
NHibernate.Spatial
ASP.NET MVC 3 with Membership/Role providers
[FOLLOW UP]
I ran the NuGet command "Install-Package Nauck.PostgresSQLProvider" to install the PostgreSQL ASP.NET Membership Provider created by Daniel Nauck and Jason Sznol.
http://nuget.org/List/Packages/Nauck.PostgresSQLProvider
Project Home
http://dev.nauck-it.de/projects/aspsqlprovider
You'll need to run this SQL to create the membership tables:
http://dev.nauck-it.de/projects/aspsqlprovider/repository/revisions/master/changes/src/NauckIT.PostgreSQLProvider/DatabaseSchema.sql
Finally the web.config file will need to be updated... I used this example for direction:
http://dev.nauck-it.de/projects/aspsqlprovider/repository/revisions/master/entry/src/Example/Web.config
So far authentication works, as does hashed passwords, all thats left to test is authorization.

I was a little frustrated with the nauck version, so I wrote my own. You can try it out here it you'd like. It has unit tests and a bit of documentation.

Related

can two project ( MVC5 and ASP.NET CORE3.1) use the same database?

I made another project and didn't connect to the database yet. The database has configured with MVC5 patterns which include Membership provider and some depreciated functions such as SQLRoleProvider. It is working great on MVC5 project and I made a new ASP.NET CORE 3.1 project below MVC5 project. I can't use the current login function so I should make a new login function fit to the core version.
I am lost from here. Do I just put ```GetConnectionSTring`` as we do with EF? But I am not using EF but I use LLBLgen for dataaccess layer. How can I use the database to authenticate from the MVC5 version database?
I also wonder how I write a code for login in .Net Core loginController. I have to make a custom authentication because I am trying to access database which has been made by MVC5. Can you guys recommend anything that I can look up?

Coordination WebMatrix.Data and WebMatrix.WebData work with Oracle DB

i have a MVC 5 project with an oracle DB,
i need to use sum sort of membership provider, as i understand it,
at the moment there's no boilerplate provider which works with OracleDB for mvc.
can anybody recommend a solution?
I'm trying to adjust microsoft "WebMatrix.Data" and "WebMatrix.WebData" to work with oracle ,i have the source code from http://aspnetwebstack.codeplex.com/SourceControl/network,
has anyone tried this before? and if so perhaps can help with helpf links or the code?
as it happens i solved it by downloading the source code for WebMatrix from Microsoft git and rewriting the entire project to work with Oracle DB

Building a First Run Installer in ASP.NET MVC

I'd like to build a web installer into my ASP.NET MVC application. It would be a first run installer that would allow the user to create a user account, set database connection strings, and configure some first run settings. I was looking at SPA's like HotTowel and OAK. Any advice on a good direction to go would be appreciated!
I've not done this myself but I know Orchard CMS http://www.orchardproject.net/ has similar to what you require. Reviewing their code might be a good place to start.

Entity Framework 6.0 Code First Migrations to Azure SQL DB not working.

I am trying to create an ASP.NET MVC site loosely based on this tutorial.
http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/
I am using VS2013 preview which gave me the option to create an ASP.NET MVC 5 site. Also, using the following packages:
EntityFramework 6.0.0-rc1
Microsoft.AspNet.Identity.Core" 1.0.0-alpha1
Microsoft.AspNet.Identity.EntityFramework 1.0.0-alpha1
After configuring a website and associating it with a database in Azure, I proceeded to run the following commands in the package manager console:
enable-migrations -ContextTypeName IdentityDbContext
add-migration Initial
When I published to Azure with the database specified and the "Execute Code First Migrations" checkbox checked, the site deployed properly, but after inspecting my DB, the migrations didn't run. My migrations had been successful previously on a site with ASP.Net MVC 4 and EF 5.0.
I would guess the problem is that EF 6 is ignoring the connection string that is set during publishing, but I cannot understand why.
Any help would be appreciated. Thank you.
This guide looks comprehensive: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
The key part being "Execute Code First Migrations (runs on application start)"
I hope that helps.
When I faced this, I needed to change the connection string to point to the Azure DB instead of the local SQLLite DB.

Deploying EF 4.1 code-first ASP.NET MVC3 to medium trust shared hosting

I think, this is quite common situation nowadays, so its surprising, that I have troubles finding nice and clean solution for it (even here at SO).
I have my ASP.NET MVC3 web application using Entity Framework 4.1 with code-first approach (using DatabaseInitializer to seed default data). I also tried two database options: SQL Express 2008 R2 and SQL Compact 4. Everything is working fine on local.
Now I want to host my app so I found hosting (middle one called 'optimal') and finally (after some issues) got into state, where I am getting medium-trust error (I believe).
The application attempted to perform
an operation not allowed by the
security policy. To grant this
application the required permission
please contact your system
administrator or change the
application's trust level in the
configuration file.
Let's take as fact that I can't configure that hosting any way and I do not think, that they are going to switch me to full-trust.
What do I have to do, to make my application work on medium-trust hosting?
Edit: I have found some answers that are usually propagating setting medium trust at local dev and just do it like that, so my question could now be something like:
What are "top 5 reasons" why your ASP.NET MVC3 EF 4.1 app won't work at medium-trust?
Edit: I have added bounty to this becuase I would like to see some discussion.. or at least more oppinions/experiences, containing more than just "set medium trust at local dev". Maybe there is nothing to discuss here, but I am just curious because I already spent more time on this than I would like.
I've seen other people complain of the same error when the server did not have .NET 3.5 Service Pack 1 and were able to work around it by putting the DLLs in their bin folder.
There's also a little more info here about a few things to check:
log4net throwing Security Exception in ASP.Net MVC web application
Do you have the latest EF Code First library? Everything before the RC was not medium trust compatible.
If you are going to use SQL CE 4, it is medium trust compatible but did you deploy the SQL CE database engine files?
Are you sure your problem is EF Code First? AKA - Have you tried just deploying a simple MVC site first and getting it running? Here's an article on setting up MVC in medium trust and another on bin deploying MVC3 for hosts who aren't running/supporting MVC3 yet.

Resources