Search code examples
visual-studio-2013global-asax

web service: global.asax issuing errors


This is the line:

<%@ Application Codebehind="Global.asax.cs" Inherits="WebApiTest" Language="C#" %>

generates:

Error 1 Illegal syntax. Expecting valid start name character.
Error 2 Character '%', hexadecimal value 0x25 is illegal in an XML name. Error 3 The character '@', hexadecimal value 0x40 is illegal at the beginning of an XML name. Error 4 Character '@', hexadecimal value 0x40 is illegal in an XML name.
Error 5 Missing attribute value on attribute 'Application'. Error 6 Character '%', hexadecimal value 0x25 is illegal in an XML name.

yet it runs ok but would like to get rid of these errors, not sure how.


Solution

  • The code is correct. Checkout the default editor of your file in VS, maybe you are mistakenly using a standard XML editor for editing the *.asax file.