hello YAF guru's,
I have created another website (main.domain.com) which uses the same YAF database of the yaf website (forum.domain.com). My goal is to have a registration page on main.domain.com which uses the same process of the forum.domain.com.
Since both sites are just in a single solution, i was able to import the necessary classes into the main.domain.com web application and add the assemblies into the web.config.
Then I add code to my created_user event similar to that of the register.ascx of forum.domain.com:
[code=csharp]
MembershipUser user = UserMembershipHelper.GetUser(this.cuwCreateMember.UserName);
YafUserProfile userProfile = YafUserProfile.GetProfile(this.cuwCreateMember.UserName);
userProfile.Save();
RoleMembershipHelper.SetupUserRoles(1, this.cuwCreateMember.UserName);
string displayName = ((TextBox)this.cuwCreateMemberStep.ContentTemplateContainer.FindControl("tbRealName")).Text.Trim();
int? userID = RoleMembershipHelper.CreateForumUser(user, displayName, 1);
LegacyDb.user_save(
userID,
1,
null,
null,
null,
600,
null,
null,
null,
null,
null,
null,
null,
null,
null,
false,
null,
null);
[/code]
It all builds succesfully but I do get a run time error upon completion of registering a new user:
[code=plain]
System.Reflection.TargetInvocationException was unhandled by user code
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at YAF.Classes.Data.MsSqlDbAccess.GetConnectionManager() in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbAccess.cs:line 502
at YAF.Classes.Data.MsSqlDbAccess.GetDatasetBasic(IDbCommand cmd, Boolean transaction) in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbAccess.cs:line 604
at YAF.Classes.Data.MsSqlDbAccess.GetData(IDbCommand cmd, Boolean transaction) in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbAccess.cs:line 538
at YAF.Types.Interfaces.IDbAccessExtensions.GetData(IDbAccess dbAccess, IDbCommand cmd) in F:\FreeProjects\InterMed\CheriferProject\YAF.Types\Interfaces\Extensions\IDbAccessExtensions.cs:line 87
at YAF.Classes.Data.LegacyDb.group_list(Object boardID, Object groupID) in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\LegacyDb.cs:line 4401
at YAF.Core.RoleMembershipHelper.SetupUserRoles(Int32 pageBoardID, String userName) in F:\FreeProjects\InterMed\CheriferProject\YAF.Core\UsersRoles\RoleMembershipHelper.cs:line 275
at site.cherifer.ph.Default.cuwCreateMember_CreatedUser(Object sender, EventArgs e) in F:\FreeProjects\InterMed\CheriferProject\site.cherifer.ph\Default.aspx.cs:line 43
at System.Web.UI.WebControls.CreateUserWizard.OnCreatedUser(EventArgs e)
at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser()
at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at DevExpress.Web.ASPxEditors.ASPxButton.OnCommand(CommandEventArgs e)
at DevExpress.Web.ASPxEditors.ASPxButton.RaisePostBackEvent(String eventArgument)
at DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=YAF.Classes.Config
StackTrace:
at YAF.Classes.Config.get_ConnectionString() in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Config\Config.cs:line 143
at YAF.Classes.Data.MsSqlDbConnectionManager.get_ConnectionString() in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbConnectionManager.cs:line 78
at YAF.Classes.Data.MsSqlDbConnectionManager.InitConnection() in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbConnectionManager.cs:line 162
at YAF.Classes.Data.MsSqlDbConnectionManager..ctor() in F:\FreeProjects\InterMed\CheriferProject\YAF.Classes\YAF.Classes.Data\mssql\MsSqlDbConnectionManager.cs:line 55
InnerException:
[/code]
I tried stepping through the code and it runs an exception on:
YAF.Classes.Data
MsSqlDbAccess.cs
at the following lines:
[code=csharp]
[CanBeNull]
public IDbConnectionManager GetConnectionManager()
{
return Activator.CreateInstance(this._connectionManagerType).ToClass();
}
[/code]
But being a no0b i just cant get to wrtap my head around this. Could somebody point me to the right direction?
Thanks in advance.
|