Is this invalid to put in an aspx file? I have some static aspx pages and I want to add a bit of C# to one of them. How can I do this?
I figured just adding
<%@ Page Language="c#"%>
and then using <% %> to put a bit of C# goodness in there, but it says Syntax Error. with a blue wavy line over this code.
This happens whenever you change the Language attribute of the Page directive. Simply close the file in Visual Studio, and reopen it. The error will go away.
It's not entirely clear from your question, but are you adding multiple Page directives? You can only have one per .aspx file.
Otherwise what you've got there is valid. If your page works fine and VS is still showing it as an error, quit out of VS entirely and restart it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With