Re: How to run a Hello world in .NET Framework

Dinesh Upare <[email protected]> Wed, 26 Jun 2002 11:42:52 +0530
Newsgroups gmane.comp.windows.devel.dotnet.general
Message-ID <002401c21cd8$832d4150$6364a8c0@dinesh>
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 ="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 site, download the second
> option, the one you have is just the 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 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 more involved but quite simple once you get the
> hang of it. When you use code behind there are two files
> that you need to have, the *.aspx 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 of the *.aspx file is as follows:
>
>
>         <%@ Page Inherits="HelloWorld" Language="C#" %>
>
>         <html>
>
>                 <head>
>
>                         <title>HelloWorld</title>
>
>                 </head>
>
>                 <body>
>
>                         <form runAt="server">
>
>                                 <asp:literal id="Message" runAt="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 = "Hello World!";
>
>                 }
>
>         }
>
> Copy the HelloWorld.aspx file to the C:\Inetpub\wwwroot
> directory on your computer (I am assuming that you have
> IIS installed), then 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
> [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
> application say (Hello World) with a small content in a code behind page
> also.
>
> Please Help me !!
>
> Thanks in Advance
> Mathews.
>
> 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.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.