Create ASP.NET 1.0 & 2.0 Applications On GNU/Linux and Windows Using Mono XSP
This post assumes that Mono is installed on your system. The following links should help if it is not installed.
Installing Mono on Gentoo and Ubuntu 5.10
Installing Mono and XSP on Ubuntu 6.06
Installing Mono and XSP on Fedora
Installing Mono XSP on Gentoo
Installing Mono XSP on Debian/(K)Ubuntu
Installing Complete Mono Environment(Mono, GTK#, XSP) on MS Windows
- Download the Mono installation file for MS Windows from the Mono website.
- Run the installer and follow the installation wizard.
Go to the Mono menu in the Start menu(Start->All Programs->Mono[version]) to access all the applications installed as part of Mono.
Your First ASP.NET 1.0 Application Using Mono XSP
- First create a directory to store the ASP.NET files and change to that directory. You can create the directory in your home directory.
sh# mkdir aspnet && cd aspnet
- Create a sample ASP.NET page. Copy and paste the following code in two separate files(hello.aspx and hello.aspx.cs).
hello.aspx
HTML:-
<%@ Page language="c#" src="hello.aspx.cs"
-
Inherits="HelloApp.HelloPage" AutoEventWireup="true" %>
-
<title>First Mono ASP.NET 1.0 Application</title>
-
</head>
-
<H1>Welcome to my page!</H1>
-
<form runat="server">
-
Enter your name: <asp:TextBox id="name" runat="server" />
-
<asp:Button id="greet" Text="Greet" onClick="OnGreetClick" runat="server"/>
-
</form>
-
</asp:Label></strong>
-
</body>
hello.aspx.cs
C#:-
using System;
-
using System.Web.UI.WebControls;
-
-
namespace HelloApp
-
{
-
public class HelloPage : System.Web.UI.Page
-
{
-
protected Label message;
-
protected Button greet;
-
protected TextBox name;
-
-
public void OnGreetClick(Object sender, EventArgs e)
-
{
-
message.Text = "Hello, " + name.Text;
-
}
-
}
-
}
-
- From the same directory('aspnet'), start the XSP server:
sh# xsp
(you can press ENTER to terminate the XSP server process)
- Open a web browser, type the url http://localhost:8080/hello.aspx and press ENTER. You should see a web page with a text box and a message. Enter a name in the text box and click the "Greet" button to see the personalised greeting displayed.
On MS Windows, go to the Mono menu in the Start menu(Start->All Programs->Mono[version]), select "Mono[version] Command Prompt" menu item. Create a directory(say 'c:\programs\aspnet'), change to that directory and copy the above two files in that directory. From the same directory, run 'xsp' commad to start the XSP webserver. Open a web browser and access the url http://localhost:8080/hello.aspx.
Your First ASP.NET 2.0 Application Using Mono XSP
To develop ASP.NET 2.0 applications using Mono XSP server, start 'xsp2' webserver instead of 'xsp'. Create a test ASP.NET 2.0 page(say 'hello2.aspx') and copy it in a folder. Run the following command from the same folder:
Go to http://localhost:8080/hello2.aspx to test the ASP.NET 2.0 page.
Related Posts:
Readers who viewed this page, also viewed:
- GNU/Linux Users vs Rest of the world :)
- Installing C#, Mono(.NET) & MonoDevelop in Ubuntu Dapper Drake 6.06
- Finally Got 3D Desktop Effects in My Ubuntu Gutsy (ATI Hardware)
- My Favourite Note-Taking Applications
- C# & MonoDevelop (.NET) on Gentoo and Ubuntu
Will this work with VisualBasic as while?
QuoteComment by Myles A. Braithwaite — July 25, 2006 @ 7:17 pm
Report from OSCON2006: The Ruby Conspiracy, Other stuff......
Report from OSCON2006: The Ruby Conspiracy
QuoteSoftware Development Amidst the Whiz of Silver Bullets... -......
Trackback by Hulkster — July 27, 2006 @ 5:12 pm
There still are some rough edges when it comes to developing ASP.NET applications using VB.NET. You can certainly give it a try but you may or may not get the results: the errors the VB.NET compiler sometimes produces are very irritating.
VB.NET support is being developed at a fast pace though. Until the time it becomes a bit more stable, the best way would be to manually compile the VB.NET code-behind file to a 'dll' file and then use it from the ASPX file('C#' should be specified as the language being used; it doesn't matter with IL being present in the dll). If you find the VB.NET compiler that comes with mono('mbas') not upto the task, then use a Windows machine to create the dll files and copy them over to the GNU/Linux box. Not an ideal way to develop web applications, but works for now.
QuoteComment by tabrez — July 28, 2006 @ 4:54 pm
Your First ASP.NET 2.0 Application Using Mono XSP
Create a test ASP.NET 2.0 page(say 'hello2.aspx') and copy it in a folder.
How about giving us working 2.0 files to test?
QuoteComment by 2.0NOT — October 26, 2006 @ 12:54 am
I always have terrible trouble with comment-related plugins that require me to put some line in the comment loop; I can never seem to find the right spot. Can anyone tell me where I should put the php line in my comments loop? I haven not modified anything much, and I would be very grateful. Thanks!
QuoteComment by trmadol — January 25, 2007 @ 9:16 pm
i think that the 'src' atribute is no longer supported in xsp2
QuoteComment by eduardo osorio — June 21, 2007 @ 3:39 am