knightout
New member
- Joined
- Sep 24, 2022
- Messages
- 1
- Programming Experience
- 10+
Hi,
I'm trying to build a very simple site in C#/.Net as a front-end to a database but failing at the first hurdle and can't seem to find any help online.
I've done fairly extensive classic ASP/VB script many, many years ago, but this is a first attempt to do anything connecting to a db in c#.
What happens is, as soon as I try to declare the required namespaces, the page causes an error.
So, my .aspx page looks like this:
<%@ Page Language="c#" AutoEventWireup="true" CodeBehind="100char.aspx.cs" Debug="true" %>
<%
using System;
%>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
<head>
<title>test c# page</title>
</head>
<body>
<p>This page doesn't work.</p>
</body>
</html>
And the error is:
CS1003: Syntax error, '(' expected
If I take out the 'using System;' and put in some other standard code like 'string strWhatever="something"' the page works as expected.
I'm sure I'm missing something painfully obvious and basic, or maybe something that needs to be configured in IIS, but any help appreciated. Thank you.
I'm trying to build a very simple site in C#/.Net as a front-end to a database but failing at the first hurdle and can't seem to find any help online.
I've done fairly extensive classic ASP/VB script many, many years ago, but this is a first attempt to do anything connecting to a db in c#.
What happens is, as soon as I try to declare the required namespaces, the page causes an error.
So, my .aspx page looks like this:
<%@ Page Language="c#" AutoEventWireup="true" CodeBehind="100char.aspx.cs" Debug="true" %>
<%
using System;
%>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
<head>
<title>test c# page</title>
</head>
<body>
<p>This page doesn't work.</p>
</body>
</html>
And the error is:
CS1003: Syntax error, '(' expected
If I take out the 'using System;' and put in some other standard code like 'string strWhatever="something"' the page works as expected.
I'm sure I'm missing something painfully obvious and basic, or maybe something that needs to be configured in IIS, but any help appreciated. Thank you.