Problems creating head section - Unrecognized tag prefix or device filter 'asp'

Discussion in 'ASP .Net' started by Luurs, Aug 3, 2006.

  1. Luurs

    Luurs Guest

    Hi All,

    I've been using a asp-label in the HTML <head> section for quite some
    time in order to dynamically generate meta-keywords,-description, css
    and js references.
    Though the actual HTML-output isn't that pretty (<span>'s in the
    head-section...) it works fine with browsers, crawlers. It never REALLY

    was an issue...


    However, in VS2005 this method is considered to be an error
    "Unrecognized tag prefix or device filter 'asp'". I do understand it's
    because the label is not placed within the <FORM>, etc, etc...
    Still, Is there a good reason why "suddenly" the method is thought to
    be an "Error"?
    Will it have any consequences, now or in the near future if I just
    ignore the error-warning and continue using the method?
    If NOT, can I filter out this specific error from the error-list
    (Without loosing the "Unrecognized tag prefix or device filter
    'asp'"-error for other occasions)?
    If YES, is there a good alternative available?


    The MSDN solution
    http://msdn.microsoft.com/library/en-us/MCMSSDK02/html/9a042924-3a16-...

    is just another way of creating the same problem.
    I did quite some searching/trying out myself, but all option had their
    disadvantages so far...


    The desired solution would be something like this:
    <head id="PageHead" runta="server"> in the .aspx file, and in the
    codebehind something like:
    HtmlGenericControl pageHead =
    (HtmlGenericControl)this.Page.FindControl("PageHead");
    pageTitle.InnerText = "page-title, Meta/etc-stuff in here";


    This works great, and it also removes the annoying
    <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5"
    name="vs_targetSchema">
    from the head section!


    However, somehow a second (empty) <title></title> is inserted just
    before </head>!
    It, needs no explanation that this is unwanted behavior...
    Is it a ASP.Net issue or a CMS-feature?
    Does anyone know why, how and when this is happening?


    I really want to move our VS 2005 solution to runtime, but feel
    uncertain about the current situation (as described on top of this
    post).


    I'm using VS 2005 prof. edition on a Windows Server 2003...


    Any help would be much appreciated!
    Luurs
     
    Luurs, Aug 3, 2006
    #1
    1. Advertisements

  2. Luurs

    Alan Silver Guest

    Literal controls are more useful for this sort of thing as they do not
    add anything. Whatever you set the Text property to, that's what will be
    Well known bug in VS2005. Usually cured by either deleting the schema
    files, or just keeping the master page open in the IDE.

    Either way, you can safely ignore the error as long as your pages
    compile OK.
    That's not the reason. Not all server controls have to be inside a form.
    Don't know what that is as the link you provided was incomplete,
    however, the two suggestions above usually fix it.
    Painful way to do this. The page title can be set using...

    Page.Title = "My page";

    if you want to do it dynamically, or simply using the Title attribute of
    the @Page directive if it's static.

    Meta tags, CSS, Javascript, etc can all be added to the header simply by
    adding a contentplaceholder inside the <head> tag and putting your meta
    tags, etc inside the content control on the .aspx page. It's much
    simpler than the messy way MS implemented it.
    Do it the way I suggested and you won't get these either. You'll only
    get exactly what you want in there.
    You don't need to add a <title> tag, just set Page.Title and the
    framework will add the tag for you. I suspect you are adding your own
    tag and the framework is adding its own, resulting in two.
    No, but try it the way I suggested and see if it still happens. If yes,
    then it's not an ASP.NET issue as I do this all the time and it works
    fine.
    Me too. HTH
     
    Alan Silver, Aug 8, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.