In Windows Forms, I can create a class file called "Authentication.cs" with the following code:
public class Authentication
{
public string Name;
internal bool Authenticate()
{
bool i = false;
if (Name == "Jason")
{
i = true;
}
return i;
}
}
In WebMatrix, I can insert a new class file called "Authentication.cs" and paste the above code.
And in my default.cshtml file, I do this:
<body>
@{
Authentication auth = new Authentication();
if(auth.Authenticated("jasonp"))
{
<p>@auth.Authenticated("jasonp");</p>
}
}
</body>
But that will not work! It works for a WinForms desktop application, but not in WebMatrix. I do not know why it does not work. Error message:
"Authenticate namespace does not exist. Are you sure you have reference assemblies, etc.?
So then at the top of my default.cshtml file I tried this:
@using Authentication.cs;
This led to the same error!
There is no documentation that I can find anywhere that tells me how to "include" a class file in WebMatrix pages.
Any help is appreciated
Thank!
anon271334