Convert CodeFile to CodeBehind

As such, I seem to have some difficulty making a reference to the CodeFile in CodeBehind. Before asking, I don't have Visual Studio, and I'm not on Windows. The code is hosted on an IIS server to which I have access.

<% @Page Language="C#" Inherits="corn.cheese.pies.CasLogin" CodeFile="anon.cs" %>

This code works fine, however when changing it:

<% @Page Language="C#" Inherits="corn.cheese.pies.CasLogin" CodeBehind="anon.cs" %>

An error message appears on the page:

Parser Error Message: Could not load type 'corn.cheese.pies.CasLogin'.
+5
source share
1 answer

Are you sure you understand the difference between CodeFile and CodeBehind? See, for example, CodeFile vs CodeBehind (ignore the accept answer, although both links are dea) or this article on the difference.

In a nutshell:

Assuming file

A CodeBehind , bin -. ASP.NET aspx, Inherits, . CodeBehind ( , , " " ), .

CodeFile ASP.NET , . " " -, , , -. CodeFile .cs, , ASP.NET. ( : CodeFile - partial class, , #, CodeFile , # .)

CodeFile CodeBehind, ASP.NET # . ASP.NET, , , , .

+14

All Articles