Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have started learning asp.net. I went through basics and now i am started to build small application.
I am using VS 2012 and created Empty Web Application Project with VB.
I can see web.config created automatically and following are the line written in it :
<?xml version="1.0"?>
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration>
I created Default.aspx file and wrote following lines of code :
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" %>
HelloWorldLabel.Text = "Hello, world!";
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<form id="form1" runat="server">
<asp:Label runat="server" id="HelloWorldLabel"></asp:Label>
</form>
</body>
</html>
When I am running this application on browsers, I am getting following error that page :
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30037: Character is not valid.
Source Error:
Line 2:
Line 3: <%
Line 4: HelloWorldLabel.Text = "Hello, world!";
Line 5: %>
Line 6:
Source File: c:\users\anjum.banaras\documents\visual studio 2012\Projects\Students\Students\Default.aspx Line: 4
Can any one help me on this ? I am just beginner on asp.net. Your help can save lots of my time.
Thanking you in advance !!
–
–
You've set the programming language of the page to VB (Visual Basic), but the line it is complaining about is written in C# syntax. Either change the line to be valid VB code:
HelloWorldLabel.Text = "Hello, world!"
(I think that removing the ;
is all that's needed, but I never code VB so I'm not sure)
or change the page language to C#:
<%@ Page Language="c#" AutoEventWireup="false" CodeBehind="Default.aspx.vb" %>
–
–
–
–
I copied my code to another editor (notepad++) and was able to see the problematic chars. After i removed them, the code worked again.
��myClass.myArray(28) = "myFirstValue"
��myClass.myArray(29) = "myValue"
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.