locked
Parser error RRS feed

  • Question

  • User-1793215261 posted

    Hello

    I have a Web page in VS 2017 (Web Forms). When I load the page in my browser with this code at the top of the page:

    <%@ Page Title="Home Page" Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!DOCTYPE html>
      <html lang="en">
      <head runat="server">
    
    <link id="css-preset" href="css/presets/preset1.css" rel="stylesheet">
    
    </head>

    I get the following error:

    Parser Error

    Parser Error Message: 'css-preset' is not a valid identifier.

    Source Error:

    Line 21:   <link id="css-preset" href="css/presets/preset1.css" rel="stylesheet">

    However, if I remove this line:

    <head runat="server">

    the page loads as it should do.

    I am not sure what the relationship is between the preset1.css file and  <head runat="server"> or if that relationship is the source of the parser error, but I need to use both lines of code.

    How can I best achieve that, please?

    Thank you.

    Friday, June 8, 2018 3:19 PM

Answers

  • User409696431 posted

    Using runat="server" means the <head> is being processed by asp.net.  Hyphens are not valid characters in asp.net id's.  Change the id to something without a hyphen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 9, 2018 2:05 AM

All replies

  • User409696431 posted

    Using runat="server" means the <head> is being processed by asp.net.  Hyphens are not valid characters in asp.net id's.  Change the id to something without a hyphen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 9, 2018 2:05 AM
  • User-1793215261 posted

    Thank you for that Kathy. The error has gone.

    Regards

    Monday, June 11, 2018 2:33 PM