Reputation: 1112
I'm relatively new to ASP.NET (haven't touched it since .NET was first introduced). I'm using Visual Studio Express For Web 2012.
I've created a master page to work with. However, whenever I create a new page, the default value for "inherits" at the top of the page causes the page to not load, with a "could not load type" error.
I haven't even started coding yet, so I'm not sure what it's looking for.
Edit to add:
Top of a new page looks like this:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="Bitfork.login" %>
The generated code behind page:
namespace Bitfork
{
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Upvotes: 1
Views: 296
Reputation: 10565
This issue was caused in my website when I was using CodeBehind
property in <%@ Page ..>
directive,
As soon as I changed it to :CodeFile
, it worked without the need to recompile every time. I guess from ASP.NET 2.0 onwards this is the case for website templates.
What I observed was that [ framework 4 ], when I create website, the <%@ Page ..>
directive contains CodeFile
. When create WebApplication, then the <%@ Page ..>
directive contains: CodeBehind
.
This post may be helpful: ASP.Net 3.5/4.0 CodeBehind or CodeFile?
Upvotes: 1
Reputation: 1112
Issue resolved - I didn't realize I needed to recompile the page between each page load.
Upvotes: 0