ASP.net Part 1

Embed Size (px)

Citation preview

  • 8/6/2019 ASP.net Part 1

    1/15

    ASP.NETASP.NET

    Abd Rahman Bin AhmadAbd Rahman Bin Ahmad

  • 8/6/2019 ASP.net Part 1

    2/15

  • 8/6/2019 ASP.net Part 1

    3/15

  • 8/6/2019 ASP.net Part 1

    4/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    What is an ASP File?What is an ASP File?

    An ASP file is just the same as an HTML fileAn ASP file is just the same as an HTML file

    An ASP file can contain text, HTML, XML, andAn ASP file can contain text, HTML, XML, and

    scriptsscripts

    Scripts in an ASP file are executed on theScripts in an ASP file are executed on the

    serverserver

    An ASP file has the file extension ".asp"An ASP file has the file extension ".asp"

  • 8/6/2019 ASP.net Part 1

    5/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    How Does it Work?How Does it Work?

    When a browser requests an HTML file, theWhen a browser requests an HTML file, theserver returns the fileserver returns the file

    When a browser requests an ASP file, IISWhen a browser requests an ASP file, IISpasses the request to the ASP engine on thepasses the request to the ASP engine on theserverserver

    The ASP engine reads the file, line by line, andThe ASP engine reads the file, line by line, and

    executes the scripts in the fileexecutes the scripts in the file Finally, the ASP file is returned to the browser asFinally, the ASP file is returned to the browser as

    plain HTMLplain HTML

  • 8/6/2019 ASP.net Part 1

    6/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    What is ASP.NET?What is ASP.NET?

    ASP 3.0 is the latest version of ASP, but there willASP 3.0 is the latest version of ASP, but there willnever be an ASP 4.0 version.never be an ASP 4.0 version.

    ASP.NET is the next generation ASP, but it's not anASP.NET is the next generation ASP, but it's not anupgraded version of ASP. ASP.NET is an entirely newupgraded version of ASP. ASP.NET is an entirely newparadigm for serverparadigm for server--side ASP scripting.side ASP scripting.

    ASP.NET is a part of the .NET Framework. MicrosoftASP.NET is a part of the .NET Framework. Microsoftspent three years rewriting ASP.NET from the groundspent three years rewriting ASP.NET from the ground

    up, and ASP.NET is not fully backward compatibleup, and ASP.NET is not fully backward compatiblewith ASP 3.0.with ASP 3.0.

  • 8/6/2019 ASP.net Part 1

    7/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    .NET Framework.NET Framework

    The .NET Framework is the infrastructure for the Microsoft .NETThe .NET Framework is the infrastructure for the Microsoft .NETplatform.platform.

    The .NET Framework is an environment for building, deploying, andThe .NET Framework is an environment for building, deploying, andrunning Web applications and Web Services.running Web applications and Web Services.

    The .NET Framework contains a common language runtime andThe .NET Framework contains a common language runtime andcommon class librariescommon class libraries -- like ADO.NET, ASP.NET and Windowslike ADO.NET, ASP.NET and WindowsFormsForms -- to provide advanced standard services that can beto provide advanced standard services that can beintegrated into a variety of computer systems.integrated into a variety of computer systems.

    The .NET Framework provides a featureThe .NET Framework provides a feature--rich applicationrich applicationenvironment, simplified development and easy integration betweenenvironment, simplified development and easy integration between

    a numbers of different development languages.a numbers of different development languages. The .NET Framework is language neutral.Currently it supports C++,The .NET Framework is language neutral.Currently it supports C++,

    C#, Visual Basic,C#, Visual Basic, and JScript (Microsoft's version of JavaScript).and JScript (Microsoft's version of JavaScript).

    Microsoft's Visual Studio.NET is a common developmentMicrosoft's Visual Studio.NET is a common developmentenvironment for the .NET Framework.environment for the .NET Framework.

  • 8/6/2019 ASP.net Part 1

    8/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    New in ASP .NETNew in ASP .NET

    Better language supportBetter language support

    Programmable controlsProgrammable controls

    EventEvent--driven programmingdriven programming XMLXML--based componentsbased components

    User authentication, with accounts and rolesUser authentication, with accounts and roles

    Higher scalabilityHigher scalability

    Increased performanceIncreased performance -- Compiled codeCompiled code Easier configuration and deploymentEasier configuration and deployment

    Not fully ASP compatibleNot fully ASP compatible

  • 8/6/2019 ASP.net Part 1

    9/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    ASP .NET uses the new ADO .NET.ASP .NET uses the new ADO .NET.

    ASP .NET supports full Visual Basic, notASP .NET supports full Visual Basic, not

    VBScript.VBScript.ASP .NET supports C# (C sharp) andASP .NET supports C# (C sharp) and

    C++.C++.

    ASP .NET supports JScript as before.ASP .NET supports JScript as before.

  • 8/6/2019 ASP.net Part 1

    10/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    ASP .NET ControlsASP .NET Controls

    ASP .NET contains a large set of HTML controls. Almost all HTMLASP .NET contains a large set of HTML controls. Almost all HTMLelements on a page can be defined as ASP .NET control objects thatelements on a page can be defined as ASP .NET control objects thatcan be controlled by scripts.can be controlled by scripts.

    ASP .NET also contains a new set of object oriented input controls,ASP .NET also contains a new set of object oriented input controls,

    like programmable list boxes and validation controls.like programmable list boxes and validation controls. A new data grid control supports sorting, data paging, and everythingA new data grid control supports sorting, data paging, and everything

    you expect from a dataset control.you expect from a dataset control.

    Event Aware ControlsEvent Aware Controls

    All ASP .NET objects on a Web page can expose events that can beAll ASP .NET objects on a Web page can expose events that can beprocessed by ASP .NET code.processed by ASP .NET code.

    Load, Click and Change events handled by code makes coding muchLoad, Click and Change events handled by code makes coding muchsimpler and much better organized.simpler and much better organized.

    ASP .NET ComponentsASP .NET Components

    ASP .NET components are heavily based on XML. Like the new ADASP .NET components are heavily based on XML. Like the new ADRotator, that uses XML to store advertisement information andRotator, that uses XML to store advertisement information andconfiguration.configuration.

  • 8/6/2019 ASP.net Part 1

    11/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    User AuthenticationUser Authentication

    ASP .NET supports formsASP .NET supports forms--based user authentication, including cookiebased user authentication, including cookiemanagement and automatic redirecting of unauthorized logins.management and automatic redirecting of unauthorized logins.

    (You can still do your custom login page and custom user checking).(You can still do your custom login page and custom user checking).

    User Accounts and RolesUser Accounts and Roles

    ASP .NET allows for user accounts and roles, to give each user (withASP .NET allows for user accounts and roles, to give each user (witha given role) access to different server code and executables.a given role) access to different server code and executables.

    High ScalabilityHigh Scalability

    Much has been done with ASP .NET to provide greater scalability.Much has been done with ASP .NET to provide greater scalability.

    Server to server communication has been greatly enhanced, makingServer to server communication has been greatly enhanced, makingit possible to scale an application over several servers. One exampleit possible to scale an application over several servers. One exampleof this is the ability to run XML parsers, XSL transformations and evenof this is the ability to run XML parsers, XSL transformations and evenresource hungry session objects on other servers.resource hungry session objects on other servers.

    Compiled CodeCompiled Code

    The first request for an ASP .NET page on the server will compile theThe first request for an ASP .NET page on the server will compile theASP .NET code and keep a cached copy in memory. The result ofASP .NET code and keep a cached copy in memory. The result ofthis is greatly increased performance.this is greatly increased performance.

  • 8/6/2019 ASP.net Part 1

    12/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    Easy ConfigurationEasy Configuration

    Configuration of ASP .NET is done with plain text files.Configuration of ASP .NET is done with plain text files.

    Configuration files can be uploaded or changed while the applicationConfiguration files can be uploaded or changed while the applicationis running. No need to restart the server. No more metabase oris running. No need to restart the server. No more metabase orregistry puzzle.registry puzzle.

    Easy DeploymentEasy Deployment No more server restart to deploy or replace compiled code. ASP .NETNo more server restart to deploy or replace compiled code. ASP .NET

    simply redirects all new requests to the new code.simply redirects all new requests to the new code.

    CompatibilityCompatibility

    ASP .NET is not fully compatible with earlier versions of ASP, soASP .NET is not fully compatible with earlier versions of ASP, somost of the old ASP code will need some changes to run under ASPmost of the old ASP code will need some changes to run under ASP

    .NET..NET. To overcome this problem, ASP .NET uses a new file extensionTo overcome this problem, ASP .NET uses a new file extension

    ".aspx". This will make ASP .NET applications able to run side by side".aspx". This will make ASP .NET applications able to run side by sidewith standard ASP applications on the same server.with standard ASP applications on the same server.

  • 8/6/2019 ASP.net Part 1

    13/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    Classic PageClassic Page

    Hello W3Schools in ASP.NETHello W3Schools in ASP.NET

    The simplest way to convert an HTML page into anThe simplest way to convert an HTML page into anASP.NET page is to copy the HTML file to a new file withASP.NET page is to copy the HTML file to a new file with

    anan .aspx.aspx extension.extension. This code displays our example as an ASP.NET page:This code displays our example as an ASP.NET page:

    If you want to try it yourself, save the code in a file calledIf you want to try it yourself, save the code in a file called""firstpage.aspxfirstpage.aspx

    Hello Informatics!Hello Informatics!

  • 8/6/2019 ASP.net Part 1

    14/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    Dynamic PageDynamic Page

    The code inside theThe code inside the tags is executed on the server.tags is executed on the server.

    Response.WriteResponse.Write is ASP code for writing something to the HTMLis ASP code for writing something to the HTMLoutput stream.output stream.

    Now()Now() is a function returning the servers current date and time.is a function returning the servers current date and time.

    If you want to try it yourself, save the code in a file calledIf you want to try it yourself, save the code in a file called""dynpage.aspdynpage.asp""

    Hello Informatics!

  • 8/6/2019 ASP.net Part 1

    15/15

    Asp.Net And The .Net FrameAsp.Net And The .Net Frame

    Other Technique

    HTML

    Datetimeis

    VB.NETVB.NET

    Private Sub Page_Load(ByVal sender As System.Object,ByVal e AsSystem.EventArgs) Handles MyBase.Load

    'Put user code to initialize the page hereLabel1.Text = "The date and time is " & _DateTime.Now.ToString( )

    End Sub