Page 25 - DCAP312_WEB_TECHNOLOGIES_II
P. 25

Unit 1: Making Sense of .NET and Anatomy of an ASP.NET Page



                 Web  Services  are  software  solutions  delivered  via  Internet  to  any  device.  Today,  that   Notes
                 means Web browsers on computers, for the most part, but the device agnostic design of
                 .NET will eliminate this limitation.
               5.  One of the obvious themes of .NET is unification and interoperability between various
                 programming languages. In order to achieve this; certain rules must be laid and all the
                 languages must follow these rules. In other words we cannot have languages running
                 around creating their own extensions and their own fancy new data types. CLS is the
                 collection of the rules and constraints that every language (that seeks to achieve .NET
                 compatibility) must follow.

               6.  The CLR  and the .NET Frameworks in general, however, are  designed in such  a  way
                 that code written in one language can not only seamlessly be used by another language.
                 Hence ASP.NET can be programmed in any of the .NET compatible language whether it
                 is VB.NET, C#, Managed C++ or JScript.NET.

            File Name Extensions
            Web  applications  written  with  ASP.NET  will  consist  of  many  files  with  different  file  name
            extensions.  The  most  common  are  listed  here.  Native  ASP.NET  files  by  default  have  the
            extension .aspx (which is, of course, an extension to .asp) or .ascx. Web Services normally have
            the extension .asmx.
            Your file names containing the business logic will depend on the language you use. So, for
            example, a C# file would have the extension .aspx.cs. You already learned about the configuration
            file Web.Config.

            Another one worth mentioning is the ASP.NET application file Global.asax in the ASP world
            formerly  known  as  Global.asa.  But  now  there  is  also  a  code  behind  file  Global.asax.vb,  for
            example, if the file contains Visual Basic.NET code. Global.asax is an optional file that resides
            in the root directory of your application, and it contains global logic for your application.
            Directives

            You can use directives to specify optional settings used by the page compiler when processing
            ASP.NET files. For each directive you can set different attributes. One example is the language
            directive at the beginning of a page defining the default programming language.
            Code Declaration Blocks

            Code declaration blocks are lines of code enclosed in <script> tags. They contain the runat=server
            attribute, which tells ASP.NET that these controls can be accessed on the server and on the
            client. Optionally you can specify the language for the block. The code block itself consists of
            the definition of member variables and methods.

            Code Render Blocks
            Render blocks contain inline code or inline expressions enclosed by the character sequences
            shown here. The language used inside those blocks could be specified through a directive like
            the one shown before.

            HTML Control Syntax
            You can declare several standard HTML elements as HTML server controls. Use the element
            as you are familiar with in HTML and add the attribute runat=server. This causes the HTML
            element to be treated as  a server control. It is  now programmatically accessible  by using a
            unique ID. HTML server controls must reside within a <form> section that also has the attribute
            runat=server.




                                             LOVELY PROFESSIONAL UNIVERSITY                                    19
   20   21   22   23   24   25   26   27   28   29   30