Monday, March 26, 2012

ASP.NET User Management using MySQL

Hello,

I was asked to implement ASP.NET built in User Management using MySQL. Though It was a new work for me, Because I do have that much knowledge in ASP.NET compared to Winform.

But, Google was with me. So i started exploring the same, and found lots of articles on how to implement.

I would like to explore the same here.

I assume you have already installed MYSQL Server. :)

Steps 1:

Install MYSQL Data Provider for the version of MYSQL Installed.
After you install Data provider for MySQL you will find some new values in Machine.config file related to provider. You will find one more Entry for MySQL With Name "MySQLProfileProvider".

you can locate your Machine.config file at "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\" based on your version of .NET Framework you are using

Step 2:
Time to Make changes in Web.Config File

locate ConnectionStrings Tag and make changes as specified below

[connectionStrings]
[add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/]
[remove name="LocalMySqlServer"/]
[add name="LocalMySqlServer" connectionString="server=127.0.0.1;Database=membership;uid=root;pwd=root;CHARSET=utf8;" providerName="MySql.Data.MySqlClient"/]
[/connectionStrings]


Locate to Member ship tag and do this changes for default provider

[membership defaultprovider="MySQLMembershipProvider"]... [/membership]

Inside membership add setting for MYSQL Provider

[add autogenerateschema="true" connectionstringname="LocalMySqlServer" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" applicationname="/" requiresuniqueemail="false" passwordformat="Clear" maxinvalidpasswordattempts="5" minrequiredpasswordlength="7" minrequirednonalphanumericcharacters="1" passwordattemptwindow="10" passwordstrengthregularexpression="" name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"]

Here Note the values for autogenerateschema="true"

This is very important. if autogenerateschema value is set to true. It will create all the tables in MYSQL Database required for user Management.

for managing Profile and Role
do the following changes

[profile]
[providers]
[clear/]
[add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/]
[add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" /]
[/providers]

[roleManager enabled="true" defaultProvider="MySQLRoleProvider"]
[providers]
[clear /]
[add connectionStringName="ApplicationServices" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /]
[add applicationName="/" name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" /]
[add connectionStringName="LocalMySqlServer" applicationName="/"
name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /]
/providers]
[/roleManager]


That's it.

Run your web site and then check for added table in MYSQL database ...

OpenERP

Hello Everyone,
Having years of experience on .NET Technologies. I have never looked at anything related to open source. But was always impressed with DNN, being an open source CMS i never had a chance to explore it.

For last few months. I was introduce to OpenERP. A Python and PostgreSQL based open source ERP solution. I was impressed with it too and started exploring its functionality. I started dealing in OpenERP to attract new clients and was amazed to have an unexpected response in market.

Today we have four projects running on OpenERP for customization.

I really would like to invest more in OpenERP.

Thursday, March 1, 2012

Back again

Hello,

I am back again with new spirit. Since two i didn't a single word, But could not stay without this.

So i am back.

during these two years i came across many technologies like silverlight, WCF , WPF and OpenERP.

So, from now you will find some interesting stuffs on this.

If you want to ask and have any articles related to this, you are welcome.

you can also visit http://www.itlabsindia.in/Askus.html for a unique service.

Thank you,
Rakesh Singh
ITLabsIndia.