For a B2B customer we're developing a website containing an login. The login is loaded in a small popup and works fine when you enter the correct logindata. However, if you enter wrong login data you see a postback happening but no error is/can be shown that the login was unsuccesfull.
Due to a topic here I found out it is possible to use a notificationsubsriber to catch the OnExtranetLoginFailed event. The only thing I can't figure out is how I can call the template here? What I want to do is catch this event when the login failes, and then fill an custom template tag showing an error message. Is this even possible? Or should I use an different approach?
This is my current code;
<Subscribe(Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailed)> _
Public Class INNO_LoginNotificationSubscriber
Inherits NotificationSubscriber
''For notifications passing an object inheriting Dynamicweb.Extensibility.NotificationArgs
Public Overrides Sub OnNotify(ByVal notification As String, ByVal args As Dynamicweb.Extensibility.NotificationArgs)
Try
If Not Dynamicweb.Helper.IsAdminCall() Then
Dim extranetLoginArgs As Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailedArgs = CType(args, Dynamicweb.Notifications.Standard.User.OnExtranetLoginFailedArgs)
Dim template As Rendering.Template = TryCast(args, Dynamicweb.Notifications.Standard.Page.OnOutputArgs).template 'NullReference Excption is thrown here!
End If
Catch ex As Exception
End Try
'TODO: Add code here
'Sample usage of notifications args
'Dim paragraphArgs As Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs = DirectCast(args, Dynamicweb.Notifications.Standard.Paragraph.ParagraphNotificationArgs)
'Dim pv As PageView = CType(args, PageView)
End Sub
End Class