ASP.NET Identity for Web Forms

ASP.NET Identity for Web Forms

Postby dunderfutz » Thu 17 Apr 2014 12:31

Is there an example of how to implement the ASP.NET Identity support for a Web Form application? I have followed the online example for ADO.NET implementation and MVC and it works like a charm with Oracle 12c, but no information on how to implement with a Web Forms application. There is no Account controller in the Web Forms app, and the code in the IdentityModels.cs class is substantially different.

I realize most folks are using MVC instead of Web Forms for new applications, but we may be forced to use Web Forms in our case.
dunderfutz
 
Posts: 4
Joined: Wed 16 Apr 2014 21:12

Re: ASP.NET Identity for Web Forms

Postby Shalex » Thu 01 May 2014 16:56

Sorry for the delay. We will notify you when the corresponding walkthrough for Web Form applications is implemented.
Shalex
Devart Team
 
Posts: 7377
Joined: Thu 14 Aug 2008 12:44

Re: ASP.NET Identity for Web Forms

Postby Shalex » Tue 25 Nov 2014 11:00

Please follow the tutorial http://www.asp.net/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project with the following corrections to adjust it for using dotConnect for Oracle:

1. Skip the "Adding Identity Packages to your App" section. Instead of this, do the following:

a) install Microsoft.AspNet.Identity.Core via Manage NuGet Packages (like it was described for “Identity.E” in the original section)

b) add references to the necessary dotConnect for Oracle assemblies (by default, %installFolder% is C:\Program Files (x86)\Devart\dotConnect\Oracle\):
  • %installFolder%\Devart.Data.dll
  • %installFolder%\Devart.Data.Oracle.dll
  • %installFolder%\Web\ASP.NET Identity 2\Devart.Data.Oracle.Web.Identity.dll

c) execute the %installFolder%\Web\ASP.NET Identity 2\Install_identity_tables.sql script from the provider installation folder in your Oracle schema

2. Just after the "4" step in the "Adding Web Forms to Register Users" section replace in Register.aspx.cs:

a)
Code: Select all
using Microsoft.AspNet.Identity.EntityFramework;

with

Code: Select all
using Devart.Common.Web.Identity;
using Devart.Data.Oracle.Web.Identity;
using ApplicationUser = Devart.Common.Web.Identity.IdentityUser;

b)
Code: Select all
var userStore = new UserStore<IdentityUser>();
var manager = new UserManager<IdentityUser>(userStore);
var user = new IdentityUser() { UserName = UserName.Text };

with

Code: Select all
var userStore = new OracleUserStore();
var manager = new UserManager<ApplicationUser>(userStore);
var user = new IdentityUser() { UserName = UserName.Text };

3. On the "6" step in the "Adding Web Forms to Register Users" section specify your Oracle connection string, for example:

Code: Select all
<configuration>
   <connectionStrings>
      <add name="DefaultConnection" connectionString="User Id=my_user;Password=my_password;server=dboracle;direct=true;sid=orcl1120;" providerName="Devart.Data.Oracle" />
   </connectionStrings>
</configuration>
Shalex
Devart Team
 
Posts: 7377
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle