I am new to Umbraco, from a .net C# background. I am using Umbraco 6.1.2. I have a class in the App_Code folder which I am trying to access from razor. I know about the using statement to the namespace but it doesnt recognize it. For example, I have the following in a class in the App_Code folder:
namespace Test
{
public class DoWork
{
public string Title {get; set;}
public static string FirstTask()
{
this.Title = "Hello";
return this.Title;
}
}
}
I am trying to access this in Razor by doing the following:
using Test;
using ...
string response = FirstTask();
The code does not recognize Test in the using statement. It can’t see it at all. If I do Test.DoWork.FirstTask()
, I get the same issue (The name ‘Test’ does not exist in the current context).Any ideas what I could be doing wrong? I’ve seen this used before but don’t know why it doesnt work now. The only difference is the working solutuion was Umbraco WebForms 4.11 and my solution is 6.1.2 MVC.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/44015-access-app_code-classes-in-razor