I am adding a simple ASP.NET page to an existing page (I cannot modify / create the original project right now) that does not have code behind the file. Everything works well, except when I want to use some function that lives in another library in my project program.
Example
<%@ Page Language="C#" %> <%@ Import Namespace="MyProject.BusinessLogic" %> <HTML> <script runat="server" language="C#"> public void Page_Load(object sender, EventArgs e) { bool myBool = false; MyLabel.Text = myBool.ToString(); //works fine MyLabel.Text = MyProject.BusinessLogic.StatusManager.Get().ToString(); //does not work } </script> <body> <form id="MyForm" runat="server"> <asp:label id="MyLabel" runat="server"></asp:label> </form> </body> </HTML>
The error I get does not exist in the namespace "MyProject.BusinessLogic" (do you miss the assembly reference?)
Any idea how to fix this problem?
I tried these options: http://msdn.microsoft.com/en-us/library/d864zc1k(v=vs.85).aspx , but no luck.
-, DLL, . "<% @Assembly",
<%@ Assembly Name="SomeDll.NameHere.Dll" %>
, , . . Dll BIN , . , DLL , dll SNK ( " " )
, , dll MyProject.BusinessLogic. -, dll bin.
, , dll , <% Assembly . ASPX DLL.
DLL ASPX web.config.
ASP.NET(VS 2005) web.config
<% @Import% > ...
<%@ Application Language="C#" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Web.UI" %> <script RunAt="server"> //here you can write your C# Code public void Page_Load(object sender, EventArgs e) { bool myBool = false; MyLabel.Text = myBool.ToString(); //works fine MyLabel.Text = MyProject.BusinessLogic.StatusManager.Get().ToString(); //does not work } </script>