[Mono-list] ASP.NET sample page

Jurek Bartuszek koxta at koxta.net
Tue Nov 29 13:25:15 EST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Hi!

I'm trying to run an example asp.net page, but I get an error:

Server Error in '/~koxta' Application
Parser Error
Description: Error parsing a resource required to service this request.
Review your source file and modify it to fix this error.

Error message: Cannot find type SimpleWebApp.SimplePage

File name: /home/koxta/public_html/aspnet/example1/index.aspx    Line: 1

Source Error:

<%@ Page language="c#" Codebehind="index.aspx.cs"
Inherits="SimpleWebApp.SimplePage" AutoEventWireup="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
   <HEAD>

The index.aspx and index.aspx.cs files are located in
~koxta/public_html/aspnet/example1

Am I missing something? Isn't mod-mono-server compiling the .cs file by
itself?

Here are the sources:

koxta at main:~/public_html/aspnet/example1$ ls
index.aspx  index.aspx.cs

koxta at main:~/public_html/aspnet/example1$ cat index.aspx
<%@ Page language="c#" Codebehind="index.aspx.cs"
Inherits="SimpleWebApp.SimplePage" AutoEventWireup="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
   <HEAD>
      <title>Simple Page</title>
   </HEAD>
   <body>
      <form method="post" runat="server">
         <table width="450px" border="1px">
            <tr>
               <td colspan="2"><strong>Server Details</strong></td>
            </tr>
            <tr>
               <td>Server Name:</td>
               <td>
                  <asp:Label id="serverName"
runat="server"></asp:Label></td>
            </tr>
            <tr>
               <td>Operating System:</td>
               <td>
                  <asp:Label id="operatingSystem"
runat="server"></asp:Label>
               </td>
            </tr>
            <tr>
               <td>Operating System Version:</td>
               <td>
                  <asp:Label id="operatingSystemVersion" runat="server">
                  </asp:Label>
               </td>
            </tr>
         </table>
         <br>
         <table width="450px" border="1px">
            <tr>
               <td colspan="2"><strong>Request Details</strong></td>
            </tr>
            <tr>
               <td>Page Requested:</td>
               <td>
                  <asp:Label id="requestedPage" runat="server"></asp:Label>
               </td>
            </tr>
            <tr>
               <td>Request From:</td>
               <td>
                  <asp:Label id="requestIP" runat="server"></asp:Label>
               </td>
            </tr>
            <tr>
               <td>User Agent:</td>
               <td>
                  <asp:Label id="requestUA" runat="server"></asp:Label>
               </td>
            </tr>
         </table>
      </form>
   </body>
</HTML>

koxta at main:~/public_html/aspnet/example1$ cat index.aspx.cs
using System;
using System.Web.UI.WebControls;

namespace SimpleWebApp
{
        public class SimplePage : System.Web.UI.Page
        {
                protected Label operatingSystem;
                protected Label operatingSystemVersion;
                protected Label requestedPage;
                protected Label requestIP;
                protected Label requestUA;
                protected Label serverName;

                protected override void OnLoad(EventArgs e)
                {
                        DisplayServerDetails();
                        DisplayRequestDetails();
                        base.OnLoad (e);
                }

                private void DisplayServerDetails()
                {
                        serverName.Text = Environment.MachineName;
                        operatingSystem.Text =
Environment.OSVersion.Platform.ToString();
                        operatingSystemVersion.Text =
Environment.OSVersion.Version.ToString();
                }

                private void DisplayRequestDetails()
                {
                        requestedPage.Text = Request.Url.AbsolutePath;
                        requestIP.Text = Request.UserHostAddress;
                        requestUA.Text = Request.UserAgent;
                }
        }
}

Best regards,

Jurek Bartuszek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDjJ0K6l8uJkeTVlMRA9TaAJ4zPAzT9IvJQTQHm0dnJNR1tvKtVQCdHsYh
kBdV0gBNe3MMO4MqAMPnD2A=
=eXKB
-----END PGP SIGNATURE-----


More information about the Mono-list mailing list