Re: How to run a Hello world in .NET Framework
Paul Gaske <[email protected]> Wed, 26 Jun 2002 15:56:15 +1000
| Newsgroups | gmane.comp.windows.devel.dotnet.general |
|---|---|
| Message-ID | <[email protected]> |
Try modifying the @Page line. <%@ Page Inherits=3D"HelloWorld" Language=3D"C#" %> Would become (because of your "mitch" namespace): <%@ Page Inherits=3D"mitch.HelloWorld" Language=3D"C#" %> Cheers, Paul. -----Original Message----- From: Dinesh Upare [mailto:[email protected]]=20 Sent: Wednesday, 26 June 2002 4:13 PM To: [email protected] Subject: Re: How to run a Hello world in .NET Framework But if I create a namespace in cs file. Then the aspx file is not able to load the type HelloWorld. I modified the component as follows - using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace mitch { public class HelloWorld : System.Web.UI.Page { protected override void OnLoad(EventArgs e) { this.Response.Write("Hello World!"); } public string PrintName() { return "Dinesh + .NET"; } }//class ends }//namespace ends I tried to use this component in aspx file but the runtime is not to load HelloWorld Type. I wrote the following line in your aspx example <%@ Import namespace =3D"mitch" %> Then followed your code Then I wrote a web.config file then i added assembly there. But then the runtime able to read namespace but not the Type "HelloWorld" . Could you please write the code for aspx file if there was a namespace in your example? Thanks Dinesh ----- Original Message ----- From: "Mitch Denny" <[email protected]> To: <[email protected]> Sent: Wednesday, June 26, 2002 7:35 AM Subject: Re: [DOTNET] How to run a Hello world in .NET Framework > Mathew, > > The process of developing with the .NET Framework would be alot easier > if you downloaded the entire SDK, on the download page at the ASP.NET=20 > site, download the second option, the one you have is just the=20 > redistributable: > > http://www.asp.net/download.aspx > > You can do some things with just the redist but you don't > get any documentation which is really valuable, its really tuned for=20 > runtime, not development. > > Anyway, in order to do a hello world sample: > > using System; > > public class HelloWolrd > { > > public static void Main() > { > > Console.WriteLine("Hello World!"); > > } > > } > > You compile this with the following command: > > csc.exe /reference:System.dll HelloWorld.cs > > It will produce an executable called: > > HelloWorld.exe > > If you have trouble compiling, the path could be the > issue, you may need to add the following to your path: > > C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705 > > Building a similar HelloWorld example using ASP.NET is a little bit=20 > more involved but quite simple once you get the hang of it. When you=20 > use code behind there are two files that you need to have, the *.aspx=20 > file and the *.aspx.cs file, in this example: > > HelloWorld.aspx > HelloWorld.aspx.cs > > Note that what you name the code behind file is totally > up to you, but this is the convention that VS.NET uses. The contents=20 > of the *.aspx file is as follows: > > > <%@ Page Inherits=3D"HelloWorld" Language=3D"C#" %> > > <html> > > <head> > > <title>HelloWorld</title> > > </head> > > <body> > > <form runAt=3D"server"> > > <asp:literal id=3D"Message"=20 > runAt=3D"server" /> > > </form> > > </body> > > </html> > > And the *.aspx.cs file is: > > using System; > using System.Web; > using System.Web.UI; > using System.Web.UI.WebControls; > > public class HelloWorld : System.Web.UI.Page > { > > protected override void OnLoad(EventArgs e) > { > > this.Message.Text =3D "Hello World!"; > > } > > } > > Copy the HelloWorld.aspx file to the C:\Inetpub\wwwroot directory on=20 > your computer (I am assuming that you have IIS installed), then=20 > execute the following command on the *.aspx.cs file: > > csc.exe > /reference:System.dll > /reference:System.Web.dll > /target:library > /out:HelloWorld.dll > HelloWorld.aspx.cs > > That will produce a file called HelloWorld.dll, you > need to copy that file to the bin directory under your > IIS application, in this case: > > C:\Inetpub\wwwroot\bin > > You may need to create that directory if you haven't > gone through this process before. Once you have done > this then you can request the page at the following > URL: > > http://localhost/HelloWorld.aspx > > Anyway, that should get you started. > > ---------------------------------------- > - Mitch Denny > - [email protected] > - +61 (414) 610-141 > - > > -----Original Message----- > From: The DOTNET list will be retired 7/1/02=20 > [mailto:[email protected]] On Behalf Of Mathew James > Sent: Tuesday, 25 June 2002 17:12 > To: [email protected] > Subject: [DOTNET] How to run a Hello world in .NET Framework > > > Hi all, > > I have recently downloaded .NET Framework(21 MB) from Microsoft site > and installed in my PC (Win2k). Now How should I start to run a small=20 > application say (Hello World) with a small content in a code behind=20 > page also. > > Please Help me !! > > Thanks in Advance > Mathews. > > You can read messages from the DOTNET archive, unsubscribe from=20 > DOTNET, or subscribe to other DevelopMentor lists at=20 > http://discuss.develop.com. > > You can read messages from the DOTNET archive, unsubscribe from=20 > DOTNET, or subscribe to other DevelopMentor lists at=20 > http://discuss.develop.com. > You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.