Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1115949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:13:57+00:00 2026-05-17T03:13:57+00:00

Hey everyone, I am trying to ( temporarily! ) do some ASP.NET and C#

  • 0

Hey everyone, I am trying to (temporarily!) do some ASP.NET and C# compiling on my iMac.

Haha, it’s so funny trying to do this on an iMac, it feels so.. wrong!

Anyway, I’ve found that Mono is the best way to do this, in my opinion.

I have a simple ASP.NET page with the following code:

1  <%@ Page Language="C#" %>    
2  <html>    
3  <head>    
4  <title>Planting Trees</title>    
5  <script runat="server">    
6    protected void Page_Load(Object Source, EventArgs E)    
7    {    
8      string msg = "Let's plant some trees!<br/>";    
9    
10     // Create a new Tree    
11     Tree tree1 = new Tree();    
12    
13     msg += "I've created a tree with a height of " +    
14       tree1.height + " metre(s).<br/>";    
15    
16     tree1.Grow();    
17    
18     msg += "After a bit of growth, it's now up to " +    
19       tree1.height + " metre(s) tall.<br/>";    
20    
21     Tree tree2 = new Tree();    
22     Tree tree3 = new Tree();    
23     tree2.Grow();    
24     tree3.Grow();    
25     tree2.Grow();    
26     tree3.Grow();    
27     tree2.Grow();    
28     msg += "Here are the final heights:<br/>";    
29     msg += " tree1: " + tree1.height + "m<br/>";    
30     msg += " tree2: " + tree2.height + "m<br/>";    
31     msg += " tree3: " + tree3.height + "m<br/>";    
32    
33     Output.Text = msg;    
34   }    
35 </script>    
36 </head>    
37 <body>    
38 <p><asp:label runat="server" id="Output" /></p>    
39 </body>    
40 </html>

Now, I have this simple C# class to go along with it:

// Tree.cs, A simple C# class

public class Tree {

  public int height = 0;

  public void Grow() {
    height += 1;
  }
}

Now, the ASP.NET page is located in my home directory on my iMac and the .cs C# class file is located under bin in the home directory.

Now, I’m not 100% sure, but do I need to compile the .cs into a .dll for this to work?

Any suggestions are greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T03:13:57+00:00Added an answer on May 17, 2026 at 3:13 am

    You’ll need to setup mod_mono so you actually have an application server to serve up pages.

    That said, you’re right that you need to compile your .CS into a .NET assembly (DLL).

    I can only speak from the Windows world, but I assume the mono world is much the same. You can’t just compile your class and have it run – an ASP.NET web application expects a few things (like global.asax and web.config) so it knows how your pages should be served up.

    I’m not sure what IDE you’re using, but your best bet might be to download a simple Mono sample ASP.NET application and try to stuff in your own code. All the configuration and lifecycle features can be daunting at first and quite honestly you should forget they even exist while you’re still just playing around with pages and codebehind.

    Alternately you could try going through this CodeProject: http://www.codeproject.com/KB/cross-platform/introtomono2.aspx

    It’s quite out of date but the principles remain the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone i am trying to write this code and I am having problems
Hey everyone I've looked for hours trying to find a solution to this, my
Hey everyone, a new guy here in C#.Net. I'm trying to make an application
Hey everyone I am trying to .submit some values with ajax response and i
Hey everyone. While I'm trying to learn some PHP and mySQL, I ran into
Hey everyone I am having a little problem with my jQuery I am trying
Hey everyone, my first time trying to draw a multi-color gradient in actionscript 3.
Hey everyone, great community you got here. I'm an Electrical Engineer doing some programming
Hey everyone, I am trying to figure out a way to query my mysql
Hey everyone, my problem is that im trying to figure out how to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.