How to use OracleMembershipProvider in ASP.NET MVC Application - c#

As per the suggestions in my last post, I installed all the Oracle providers in the database (by running all the sql files). I am trying to figure out how to tweak the default ASP.NET MVC2 sample (the one that gets created on a new project in VS) to use Oracle database. But I could not still figure out how to use OracleMembershipProvider instead of default membership provider.
P.S I installed the ODAC (Universal Installer version) and I could access the database from a simple ASP.NET application.
EDIT: I tried to add in section of , but am getting a configuration error:
It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level.

This link provides some information on the allowDefinition error. There are also a number of SO posts that describe this error. You may want to look at them as well and see what worked for those folks.

Related

Signing key rollover in Azure Active Directory

I am using the method mentioned in the link https://learn.microsoft.com/en-us/azure/active-directory/active-directory-signing-key-rollover#vs2012 to automatically rollover the certificates.
However the below line of code searches for <issuerNameRegistry> as a child element of the <identityConfiguration> which is deprecated according to the msdn link https://msdn.microsoft.com/en-us/library/hh568647(v=vs.110).aspx
ValidatingIssuerNameRegistry.WriteToConfig(metadataAddress, configPath);
Is there any updates coming soon to System.IdentityModel.Tokens.ValidatingIssuerNameRegistry nuget package which searches for <issuerNameRegistry> as a child element of <securityTokenHandlerConfiguration>
I am able to get the code working as there is support for backward compatibility. However I do not want to use deprecated methods
What I found worked best was to use the different versions of Visual Studio and Office 365 to see the differences in approach.
The current way has a little different syntax and all of that can be discovered by using the ASP.Net Web Application template.
If you use the template in vs2013 you will see the setup you must currently have with <federationConfiguration> and <identityConfiguration> sections, TenantDbContext, IdentityConfig and it wired up in your global.asax
If you do the same thing in vs2015 you will see that there is no longer any configuration at all besides appSettings. Everything is magically wired up through a partial class at the root called Startup.cs with more of the content hidden in the App_Start folder. This is the OWIN pipeline and has a much different feel than what you have been used to. For the better. A lot of the identity terminology is the same, the keys are the same, the management in AAD is the same so you get to reuse a lot of your code. OWIN does require MVC5 so if you can't upgrade you are pretty good where you are.
The ValidatingIssuerNameRegistry has been replaced by a TokenCache but the concept is the same, EF store for rollover safety.
More Reading:
Authentication, Authorization and OWIN – Who Moved My Cheese?
Understanding OWIN Forms authentication in MVC 5

How to put database on azure website

I recently finished my asp website, bought the domain and azure hosting. Unfortunately, when I try to do anything that accesses the database I just get stuck on a loading screen. I just used the default asp razor mvc 5 project I think for the database along with a couple of custom tables.
So here is how I would do it since you have an existing database. I would follow azures website, and set up a SQL database. I would then script out the database on you local machine, and log into your azure database using SQL Server Express. Execute the script you generated from localDB. Then all of your data will be good to go. You will then need to take the connection string from azure, and put it in your applications config file. After modifying the connection string in your application you should redeploy, and verify everything is working the way you want. You will be able to verify your data is there in SQL Server Express.
Here is a link that may be of quite a bit of assistance to you. It includes step by step instructions as well as screen shots.
Another option is using this tool. I have never used it, but I know a few people who have had great success with it.

Using ASP.NET Application Account Login for Hosted Websites

Visual Studio 2010 has a way to create a new website.
I have done that with 4 different websites, all are hosted remotely on Godaddy, and they all run fine.
All of these sites come with a default Microsoft login link:
The link goes to documentation on MSDN, but that documentation covers everything in depth. I'm not a DBA, and I have never figured out how to get one of my websites to use this feature.
In the past, I have either deleted those links or set them so they were not displayed.
Now, I'd like to learn what is required to getting them to working - just something basic.
I went there and created a new, blank Microsoft SQL database. The tables are not setup, though. That may be all I need!
Looking at the default settings in the web.config file, it looks like I can simply edit the connection string to be what I need.
Microsoft posts a link in their code, but I must confess that I really don't know what I'm looking for, so it is hard to tell when I am looking at the solution.
For a hosted website (like GoDaddy), does anyone know how to get the database setup?
I'm looking for a spoon fed, Step-By-Step, "How To" for dummies like me that spend most of their time developing Windows Forms.
You are using ASP.Net - Legacy SQL Membership Provider. It has been deprecated long time ago.
ASP.Net Identity 2 is new, but it requires .Net 4.5
Closest to Legacy Membership Provider is ASP.NET Universal Providers.
Link from the 2nd picture is for web.config in general. It doesn't include any information about Membership Provider.

Asp.net mvc 4 simple membership

I've got some silly questions, but I'm quite new in mvc and haven't found any appropriate answers,so:
1: In asp .net mvc4 internet application, as you create a new project VS. creates registration by default. If u register a new account, does mvc store this in a database? (I read that it stores, and can be found in appdata, but it's empty for me, and in server explorer there is no connetion, but I can log in and out after registration, it works perfectly.) Do I have to set a new sql server for VS or it handles this by itself? So how does this exactly work?
2: My goal is to modify the registration form to store id,name, fullname, email, registration date as you register. How can i achieve this by "extending" the default registration?
It does use a db. Check the connection string in web.config. VS 2010 uses SQL Express I believe and VS2012 uses localdb. SQL is installed with VS. The db file is usually installed in the app data folder but it does get generated until the first user is created. I suggest you get Microsoft SQL Management Studio if you want to look inside the DB, or use sever explorer from within VS.
This post perfectly answers to both of your questions

C# EF Code First Deploy to Godaddy

I am having issues deploying my app to godaddy hosting using EF code first. I dont want my app to create the database since the database already exists.
So I read some posts on here and placed this in the constructure:
Database.SetInitializer<myContext>(null);
Now I get a permission error writing to the temp file.
Anyone had a successful experience deploying this to godaddy shared hosting?
When the project used Model first and edmx files it was deployed fine.
I was able to get this to work right after posting this..
All I had to do was move:
Database.SetInitializer<myContext>(null);
to the global.asax Application_Start
Can you post what's the server error you are receiving.
setting db initializer to null should work fine. I have tried that. If you post the exception, we can probably find out why exactly that happening
You should use a generated database from the development and remove the database initializer from your code. From my experience, I always got a problem if I didn't remove the database initializer.
I've faced kind of problem before. I am using a different hosting site though. I deployed my MVC 3 Code First app back then. When I deployed the app, I didn't remove the database initializer, so the app drop the database and try to create it again. But when it create the database, it got a permission error. The problem is, the database is actually dropped in the server but in the hosting site cpanel, it is still exist. I send a ticket to the support, and problem solved.

Categories

Resources