Oops, looks like the text isn't displaying correctly ... I'm rewriting it as below:
Hi,
I hope you can help me on this, but I'm having an error when trying to programmatically send a user validation e-mail to the user when he registers in the site. We are customizing the registration process because our client needs some customizations.
Attached is the code for the registration when he clicks the Create Account button:
Code
Protected Sub btnCreate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCreate.Click
If Page.IsValid And capPostVideo.IsValid Then
Dim ui As New UserInfo
With ui
.IsSuperUser = False
.FirstName = txtFirstName.Text
.LastName = txtLastName.Text
.Username = txtUserName.Text
.DisplayName = txtFirstName.Text & IIf(txtMiddleName.Text <> "", " " & txtMiddleName.Text, "") & " " & txtLastName.Text
.Email = txtEmailAddr.Text
.Profile.InitialiseProfile(PortalId)
.Profile.PreferredLocale = PortalSettings.DefaultLanguage
.Profile.TimeZone = PortalSettings.TimeZoneOffset
.Profile.FirstName = txtFirstName.Text
.Profile.LastName = txtLastName.Text
.AffiliateID = -1
.Membership.Password = txtPassword.Text
.Membership.Approved = False
.PortalID = PortalId
End With
Dim objStatus As DotNetNuke.Security.Membership.UserCreateStatus = UserController.CreateUser(ui)
If objStatus = DotNetNuke.Security.Membership.UserCreateStatus.Success Then
Dim ps As PortalSettings = New PortalSettings(0)
DotNetNuke.Services.Mail.Mail.SendMail(ui, DotNetNuke.Services.Mail.MessageType.UserRegistrationVerified, ps)
MultiView1.ActiveViewIndex = 1
Label1.Text = objStatus.ToString()
Else
lblStatus.Text = objStatus.ToString
End If
End If
End Sub
When a user creates an account and clicks it, the user is added successfully, but this particular line registers an error in the event log as:
Event Viewer LogAssemblyVersion: 5.4.4
PortalID: 0
PortalName: My Website
UserID: 1
UserName: host
ActiveTabID: 65
ActiveTabName: NewReg
RawURL: /DNNTest/NewReg.aspx
AbsoluteURL: /DNNTest/Default.aspx
AbsoluteURLReferrer: http://localhost/DNNTest/NewReg.aspx
UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.30729; Media Center PC 5.0; .NET CLR 3.0.30729)
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: 62bf9bfa-b723-4a16-8aa0-e419ede2cdc4
InnerException: Object reference not set to an instance of an object.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: DotNetNuke.Entities.Portals.PortalSettings.GetProperty
StackTrace:
Message: DotNetNuke.Services.Exceptions.PageLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Entities.Portals.PortalSettings.GetProperty(String strPropertyName, String strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, Boolean& PropertyNotFound) at DotNetNuke.Services.Tokens.BaseCustomTokenReplace.replacedTokenValue(String strObjectName, String strPropertyName, String strFormat) at DotNetNuke.Services.Tokens.BaseTokenReplace.ReplaceTokens(String strSourceText) at DotNetNuke.Services.Localization.Localization.GetSystemMessage(String strLanguage, PortalSettings objPortal, String MessageName, UserInfo objUser, String ResourceFile, ArrayList CustomArray, IDictionary CustomDictionary, String CustomCaption, Int32 AccessingUserID) at DotNetNuke.Services.Mail.Mail.SendMail(UserInfo user, MessageType msgType, PortalSettings settings) at XSYS.Modules.CustomProfile.Register.btnCreate_Click(Object sender, EventArgs e) in C:\inetpub\wwwroot\DNNTest\DesktopModules\XSYS.CustomProfile\Register.ascx.vb:line 58 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
Source:
Server Name: XSYS-LAPTOP2
Hope you can help me out... is there anything that I missed on sending the email?
Thanks!