After I build and compile I get this error message
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 14: namespace FirstWebSite
Line 15: {
Line 16: public partial class UserInfoBoxControl : System.Web.UI.UserControl
Line 17: {
Line 18: private string userName;
I also saw notice that green underlining on 'UserInfoBoxControl' in my login.aspx file
<My:UserInfoBoxControl runat="server" ID="MyUserInfoBoxControl" />
Apparently because Element 'UserInfoBoxControl' is not a known element.
I did not declare the user control in the login.aspx page but I added it in the web.config file as
<add tagPrefix="My" src="~/controls/UserInfoBoxControl.ascx" tagName="UserInfoBoxControl"/>
and I did put the controls in a directory named Controls
please someone help as I am completely new to asp.net, thanks
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 14: namespace FirstWebSite
Line 15: {
Line 16: public partial class UserInfoBoxControl : System.Web.UI.UserControl
Line 17: {
Line 18: private string userName;
I also saw notice that green underlining on 'UserInfoBoxControl' in my login.aspx file
<My:UserInfoBoxControl runat="server" ID="MyUserInfoBoxControl" />
Apparently because Element 'UserInfoBoxControl' is not a known element.
I did not declare the user control in the login.aspx page but I added it in the web.config file as
<add tagPrefix="My" src="~/controls/UserInfoBoxControl.ascx" tagName="UserInfoBoxControl"/>
and I did put the controls in a directory named Controls
please someone help as I am completely new to asp.net, thanks
I figured it out.
First change your UserInfoBoxControl.ascx declaration from CodeFile to CodeBehind and make sure to add the namespace FirstWebsite to the inherit attribute:
<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserInfoBoxControl.ascx.cs" Inherits="FirstWebSite.UserInfoBoxControl" %>
modify your web.config file
<add tagPrefix="My" src="~/controls/UserInfoBoxControl.ascx" tagName="UserInfoBoxControl"/>
and make sure to create a directory called Controls where you add the control files UserInfoBoxControl.ascx, UserInfoBoxControl.ascx.cs, UserInfoBoxControl.ascx.designer
First change your UserInfoBoxControl.ascx declaration from CodeFile to CodeBehind and make sure to add the namespace FirstWebsite to the inherit attribute:
<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserInfoBoxControl.ascx.cs" Inherits="FirstWebSite.UserInfoBoxControl" %>
modify your web.config file
<add tagPrefix="My" src="~/controls/UserInfoBoxControl.ascx" tagName="UserInfoBoxControl"/>
and make sure to create a directory called Controls where you add the control files UserInfoBoxControl.ascx, UserInfoBoxControl.ascx.cs, UserInfoBoxControl.ascx.designer