I have created a master page Login_Nav and created two pages AuthenticationMethods.aspx and password.aspx with masterpage Login_Nav.master.
I have also created a method CheckAuth() in AuthenticationMethods.aspx page and I want to call that method into password.aspx page for that I have created the instance
Model_AuthenticationMethods authenticationMethods = new Model_AuthenticationMethods();
and it is throwing an error
Are you missing a using directive or an assembly reference
I'm not sure how to call that method CheckAuth() where I want, below is my code
Login_Nav master page:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Login_Nav.master.cs" Inherits="Login_Nav" %>
public partial class Login_Nav : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
AuthenticationMethods aspx page with master page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Login_Nav.master" AutoEventWireup="true" CodeFile="AuthenticationMethods.aspx.cs" Inherits="Model_AuthenticationMethods" %>
public partial class Model_AuthenticationMethods : System.Web.UI.Page
{
public void CheckAuth()
{
// my logic will go here
}
}
password.aspx page with master page - I want to call the CheckAuth(); method in password.aspx page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Login_Nav.master" AutoEventWireup="true" CodeFile="password.aspx.cs" Inherits="password" %>
public partial class Model_Data : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Creating an instance of Model_AuthenticationMethods
Model_AuthenticationMethods authenticationMethods = new Model_AuthenticationMethods(); //getting error "are you missing a using directive or an assembly reference"
authenticationMethods.CheckAuth()
// CheckAuth();
}
}
Please suggest how to call that method {creating an instance or using inheritance concept}
I don't have a good knowledge to achieve this concept