We're working on a very large project that has been exclusively written in VBScript/javascript/HTML. We're starting to port it over, page-by-page into C#.

We have split out common constants and code into <# Include .asp files, but when we go to try to include these files into out new C# .aspx files, we get the compiler error:

Compiler Error Message: CS1010: Newline in constant

Source Error:

Line 1:  <%
Line 2:  'This is a comment
Line 3:  'This is another comment

Of course, this is because in VBScript, ' is a comment character, and in C# it isn't.

Is there any way to pre-warn the compiler that the include is going to be in another language, like:

<%@ Language="VBScript" %>
<!--#include file='CommonConstants.asp'-->
<%@ Language="C#" %>


7 Years
Discussion Span
Last Post by ccdsystems

Text from MSDN online page.

This directive can be used only in Web Forms pages. You can include only one @ Page directive per .aspx file. Further, you can define only one Language attribute per @ Page directive, because only one language can be used per page. ....


Text from MSDN online page.

Thank you, and I realize that even though <%@ Language isn't <%@ Page, the semantics are the same. I also realize that what I'm asking for cannot be done in exactly the way I was asking. This is why I asked if there was a different way.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.