‘asp’ is an unrecognized tag prefix or device filter – what is it?

A few people reported that Visual Web Developer displayed validation error on fairly simple Web forms not recognizing ASP.NET controls. I would recommend to look at this thread in ASP.NET forums where Todd (who owns intellisense and XML schema generation) provides a few insights and possible solutions.

I blogged earlier that in VS 2005 we switched from using static XML schemas to automatically generating them using reflection on Web controls. XML schemas are generated on demand as you open pages in your Web site. They contain information about ASP.NET controls, custom and user controls. You can find generated files cache in

C:\Documents and Settings\[Username]\Application Data\Microsoft\VisualStudio\8.0\ReflectedSchemas

So, the first thing you want to do if you see dreaded “‘asp’ is an unrecognized tag prefix or device filter” error is to close all VS instances and then delete the folder contents. Restart VS, open your Web site and we will generate schemas again.

Success of the schema generation depends on several things so you may want to check in web.config is in good shape

Remember, we employ XML validation so each schema is attached to a particular element (similar to how xmlns:ns attribute works). Typically control schemas are attached to one of the top level elements such as BODY or HTML (except when page is not supposed to have any), so if your page misses root element, you may end up getting the “‘asp’ is an unrecognized tag prefix” error simply because we didn’t find any suitable root element to attach schemas to.

We are eager to improve the algorithm so please report issues either in ASP.NET forums or on the MSDN Freeback site. If you can include zipped Web site, please do so. Feel free to contact me directly as well.

Comments (20)

  1. Jason Haley says:

    Interesting finds this week

  2. Kevin says:

    This started happening to me just recently in Visual Web Deveoper Express. Removing the XML schema didn’t fix it. The problem was occuring on a page which had a master page.

    It went away when I opened the master page and it regenerated the XML schema there.

  3. Michael says:

    I ran into the exact same problem, again I was using master pages. If the master page is open in the studio along with the page then it works fine.

    I can’t beleive that this is in the final version. For the cost of the studio it should be bug free.

  4. Balaji L, UK says:

    It is really crazy bug or issue in Visual Studio 2005

    In aspx pages if you don’t have open tag "<Body>" of html, Intellisense won’t list asp server comtrols and

    it will give Error for asp.net server controls as as ‘asp’ is an unrecognized tag prefix or device filter.

    Probably while using Master pages <Body> tag could be in master pages.So I feel as the master page is open in the Visual studio along with the page , it works fine.

    This issue is not occuring for ascx pages


    Balaji L

  5. Requirement to have BODY element is not a bug, it is by design as we encourage well formed pages. Content page is obviously an exception, so the issue that you have to keep marter page open is, indeed, a bug and will be fixed in service pack.

  6. jojobar says:

    okay in my case the bug is still there even if the master page is open. Also, I noticed another thing, very strange! Say I have two content pages: page1.aspx and page2.aspx. Now say page1.aspx compiles correctly but there is a small bug in page2.aspx. When compiling the vs.net task window shows all the asp tag in both the files as errors.

    Note: I am setting the master page in web.config.

    Any other ideas… it is driving me crazzzzyyyy


  7. jojobar says:

    Update: The problem is gone when I removed the masterpage location from web.config and put it in each aspx files.

  8. This is by design in VS 2005. VS does not support master page specification in the seb.config, sorry. This may be fixed in the next release as it is popular request. The reason it is not supported is that it makes tartup performance worse as we have to load and parse multiple web.config files trying to figure out if there is a master page there. This gets worse when pages are getting open over slow connection.

  9. Tim Vasil says:

    You say, "Requirement to have BODY element is not a bug, it is by design as we encourage well formed pages."  

    This is all well and good, but you *force* developers to use <body> tags explicitly on a page or MasterPage for IntelliSense to work properly with asp controls.  It just so happens that I need more control over what goes in the body tag, so I created a user control called HtmlBody (much like .NET’s built-in HtmlHead control, but for the body).  So in my case I *do* have a well-formed page.

    It looks like this:


    <head runat="server" />

     <app:HtmlBody runat="server">

       put content here… just don’t try using an asp control and expect IntelliSense!




    I suppose the solution is to either a) drop the silly requirement that you need a <body> tag for asp IntelliSense to work (and it’s inconsistent anyway–I still get IntelliSense for my own controls and third-party controls, so what gives?), or b) provide an HtmlBody control much like the existing HtmlHead contorl.

  10. Hi Everyone:

    This is definitely a frustrating bug, and one that comes in many different shapes and sizes.  So I wanted to post my own solution from my own experience in the hope that it may help you out too.

    I found this ‘asp unrecognized tag prefix’ bug occured when I was using one of my own user controls on the page:

    <%@ Register TagPrefix=”dream” TagName=”sidebar” Src="~/Scripts/calendar/DateWindow.ascx"%>

    After reading through Todd’s thread that Mikhail recommended.  I had a suspicion that the schema was not being generated properly probably because my control was not being registered correctly.

    The registration process for this control, seems to happen when you use the register command/directive…  At this point, it generates the schema.  

    Quite literally, I believe the control is registered after you have finished typing …

    <%@ Register etc. etc into the IDE and then close the tag ‘>’ and hit the Enter key.

    In my situation I was cutting and pasting the Register command in to the page.  And I believe this caused the problem.  I stopped this practice, because I don’t think cutting and pasting code has the same effect in the IDE as typing in the code.

    When I typed the @Register command instead, and hit the enter key.  All my schemas were generated fine and the bug went away.

    So in my view, it is much better to type the Register Directive into the page and everything seems to work properly.

    If you’re cutting and pasting code, perhaps the same triggering of the creation of the schemas doesn’t happen.

    It worked for me, and I would be interested to hear about people who are having similar problems with standard <asp: controls or nested master pages scenarios etc.  Hopefully this information about the registration process may prove useful for them too??

    Good Luck.


  11. Dave Schnkel says:

    What do you mean by "instances" ?  what files specificaly are those in my project?

  12. Dave Schinkel says:

    I am also getting the same problems as Graham.  I have 2 user controls that I use to act as sort of a header and footer section of HTML across all my pages like this:

    <%@ Register TagPrefix="HD" TagName="HEADER" Src="header.ascx" %>

    <%@ Register TagPrefix="FT" TagName="FOOTER" Src="footer.ascx" %>

    I tried to manually type over the @ Register but it didn’t work as it did for Graham. I get a ton of errors in VS 2005 on missing HTML tags that are really in the ascx pages for the header and footer but for some reason VS 2005 isn’t recongizing that code like it did in 2003.

  13. Mike says:

    In my case, this happens, in VWD 2005 Express with the following setup:

    I am using a master page, only one.

    I am setting the path to the master page in the content page, not Web.Config.

    I have two asp content filters in the content page.

    The <body> tag is in the master page file, since its a common element on all pages.  Besides, when I try to put it in the content file outside of a control, I get this error:

    "Content is not supported outside ‘script’ or ‘asp:content’ regions."

    The page displays as intended, but the complier lists two errors corresponding to the two asp filters.  Nothing mentioned in this article as a possible workaround handles the issue.

  14. Unfortunately, VS 2005 does not support specification of master pages in web.config, sorry. It is high on the list of features to add in the next version.

  15. Miles Thompson says:


    sorry but hours have been wasted on this.. its very (very) annoying. if the page can compile in IIS why not in VS.NET?