Dear, thxs again for the reply but i get following errors :
Error BC30451 'lblResult' is not declared. It may be inaccessible due to its protection level.
Error BC30451 'lblManualSetupCode' is not declared. It may be inaccessible due to its protection level.
I tried to fix it with 'Generatie field 'Authenticator.lblResult' and the error disappeared, but the application does noet work.
Perhaps there are missing some files.???
I got the working code from
https://www.c-sharpcorner.com/blogs/google-authenticator-in-asp-net
Imports Google.Authenticator
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Namespace _2Fa_4_5_1
Partial Public Class Authenticator
Inherits System.Web.UI.Page
Private Property AuthenticationCode As String
Get
If ViewState("AuthenticationCode") IsNot Nothing Then Return ViewState("AuthenticationCode").ToString().Trim()
Return String.Empty
End Get
Set(ByVal value As String)
ViewState("AuthenticationCode") = value.Trim()
End Set
End Property
Private ReadOnly Property AuthenticationTitle As String
Get
Return "Ankush"
End Get
End Property
Private Property AuthenticationBarCodeImage As String
Private Property AuthenticationManualCode As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
lblResult.Text = String.Empty
lblResult.Visible = False
GenerateTwoFactorAuthentication()
imgQrCode.ImageUrl = AuthenticationBarCodeImage
lblManualSetupCode.Text = AuthenticationManualCode
lblAccountName.Text = AuthenticationTitle
End If
End Sub
Protected Sub btnValidate_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim pin As String = txtSecurityCode.Text.Trim()
Dim status As Boolean = ValidateTwoFactorPIN(pin)
If status Then
lblResult.Visible = True
lblResult.Text = "Code Successfully Verified."
Else
lblResult.Visible = True
lblResult.Text = "Invalid Code."
End If