I tried to create a custom module "MyLogin". After passing DotNetNuke login, it should automatically check if the user is available for my login database. So I need to keep DotNetNuke connection, at the same time, need another connection string because my login module uses another database on the different server than DotNetNuke database. My problem is it always accesses DotNetNuke database, I cannot get my login database connection string.
Here is what I did.
In web.config, I added section name SecurityLogin which is outside of <sectionGroupname="dotnetnuke">.
<sectionname="SecurityLogin"type="System.Configuration.SingleTagSectionHandler, system, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />
I also added the code within <connectionStrings>.
<addname="SecurityLogin"connectionString="Data Source=127.0.0.1;Initial Catalog=xxx;User ID= xxx;Password= xxx "providerName="System.Data.SqlClient"/>
Below code was added in <appSettings>.
<addkey="SecurityLogin"value="Data Source=127.0.0.1;Initial Catalog=xxx;User ID=xxx;Password=xxx"/>
I created a module MyLogin. In mylogin/sqlprovider.vb, I added the code:
Private Const ProviderType As String = "SecurityLogin"
_connectionString = ConfigurationManager.AppSettings("SecurityLogin")
In myLoginController.vb file, I have a function:
Public Function [Get](ByVal loginid As Integer) As tblloginInfo
Return CType(CBO.FillObject(DotNetNuke.Data.DataProvider.Instance().ExecuteScalar("tblloginGet", loginid), GetType(tblloginInfo)), tblloginInfo)
End Function
But this code always calls DataProvider.vb and SQLDataProvider.vb under Library but not mylogin/DataProvider.vb and mylogin/SQLDataProvider.vb. Can anyone help? why I can not get mylogin connection?
Thanks very much for any helps!!!