Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3671516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:29:47+00:00 2026-05-19T02:29:47+00:00

I created a simple custom control that only inherits from the Literal control, and

  • 0

I created a simple custom control that only inherits from the Literal control, and doesn’t have any extensions yet, code is empty.

Namespace: CustomControls

Class name: Literal : System.Web.UI.WebControls.Literal

Next thing I do is registering this control in the aspx page as following:

<%@ Register TagPrefix="web" Namespace="CustomControls" %>

(I read in few tutorials that this is one of the ways to register it, besides web.config etc.)

After all, no intellisence for me, and worse- I get a parse error ‘unknown server tag: web’ when I try to run the page with the control in it.

I used ‘create new project’ and not new website, in case this info is needed.

What could be my problem?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:29:48+00:00Added an answer on May 19, 2026 at 2:29 am

    Here is how I did it, step by step starting from nothing. This first method uses a second project/assembly. For the App_code version scroll down.

    Web Application Project Method

    1. Create a new ASP.Net Web Application. Take note of the name, mine is called WebApplication2. If you already have an existing web application, which is likely, double click the properties section of your project and check the “Assembly Name” property, make note of it.
    2. Create a new Class in the web applcation named Literal.cs
    3. Put in code similar to the following for the class defenition:

      namespace CustomControls
      {
          public class Literal : System.Web.UI.WebControls.Literal
          {
          }
      }
      
    4. Add the following register tag to the top of your aspx page

      <%@ Register assembly="WebApplication2" namespace="CustomControls" tagprefix="web" %>

    If your assembly name was different then change it here. I noticed that when I did this in VB.Net the namespace was WebApplication1.CustomControls instead of just CustomControls like it was in C#, kind of odd.

    1. Add the new control to your page:

      <web:Literal ID="Literal1" runat="server" Text="test" />

    Seperate Project Method

    1. Create a new Empty Website (ASP.Net).
    2. Add a new ASP.Net Server Control library named CustomControls to the solution.
    3. Add a new Class to the new project called Literal (I’m using C# so my file is named Literal.cs). Below is my super basic code, that I believe should match the code described in the question.

      namespace CustomControls
      {
          public class Literal : System.Web.UI.WebControls.Literal
          {
          }
      }
      
    4. Add a reference to the CustomControls project to your website.

    5. Add the assembly registration to the top of your aspx page:

      <%@ Register assembly="CustomControls" namespace="CustomControls" tagprefix="web" %>

    6. Add a new instance of the control to your page:

      <web:Literal ID="Literal1" runat="server" Text="test" />

    In App_Code Method

    1. Create a new Empty Website (ASP.Net).
    2. Add a new Class to the App_Code folder Literal2 (I’m using C# so my file is named Literal2.cs). Below is my super basic code, that I believe should match the code described in the question. I called it 2 so that you can use this in conjunction with the method described above without getting compile errors

      namespace CustomControls
      {
          public class Literal2 : System.Web.UI.WebControls.Literal
          {
          }
      }
      
    3. Register the assembly/namespace for app_code in your aspx page by adding the following line to the top

      <%@ Register Namespace="CustomControls" Assembly="__code" tagprefix="web" %>

    4. Add an instance of the new control to your page:

      <web:Literal2 ID="literal2" runat="server" Text="test2" />

    I tested this using visual studio and it all worked fine for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom control Workspace that inherits from Control and within it is
I have created a simple Asp.Net custom control which automatically combines all the correct
I have a simple custom control that boils down to a label and a
I have created a custom allocator/presenter that works fine for playback of normal media
I have created a simple wcf service which used the WCF Service Library template.
I've created a simple user control which is manually created with something like MyUserControl
I have created a simple grid of divs by left floating them and an
I've created an HTML5 video player (very simple) that works perfectly on the iPad
I'm sure I'm missing something pretty simple here. I've created a custom DateTime display
I created a simple .NET windows application in Visual Studio 2005 and on just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.