J
joe
I have trouble getting my "Hello world" test aspx page working.
I have a home page on a Windows server (a web hotel). Other HTML pages run fine
there. I tried an aspx page just to test C# but I get an error "Server Error in
'/' Application". What am I doing wrong? I've copied the Default.aspx and
Default.aspx.cs to my web page.
The page is simple enough:
Default.aspx:
//---------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Just a test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Hello there
</div>
</form>
</body>
</html>
And here's the Default.aspx.cs:
//---------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello world");
}
}
When I run it from MS Visual Web Developer 2005 express edition I run just fine.
IE page is opened and I see Hello there and Hello world.
I have a home page on a Windows server (a web hotel). Other HTML pages run fine
there. I tried an aspx page just to test C# but I get an error "Server Error in
'/' Application". What am I doing wrong? I've copied the Default.aspx and
Default.aspx.cs to my web page.
The page is simple enough:
Default.aspx:
//---------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Just a test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Hello there
</div>
</form>
</body>
</html>
And here's the Default.aspx.cs:
//---------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello world");
}
}
When I run it from MS Visual Web Developer 2005 express edition I run just fine.
IE page is opened and I see Hello there and Hello world.