mcapresentation

Upload: tanmoyguha

Post on 09-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 MCAPresentation

    1/31

    Home

    ASP . Net

    Presentation

    on

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    2/31

    Home

    .NET Framework 3 Introduction to Asp.Net 4 Overview 5 Asp.Net Features 6

    Asp.Net Page structure 9 Event Handlers 12 Web Form Page Life Cycle 13 Script Section 14 HTTP Handlers 17 Server Controls 18

    Web Server Controls 19Working with Web Objects 21 Web Services 27 A Word of Thanks 29

    Subject Slide No.

    CONTENTS

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide3.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide4.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide5.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide6.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide9.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide12.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide13.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide14.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide17.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide18.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide19.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide21.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide21.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide19.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide18.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide17.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide14.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide13.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide12.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide9.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide6.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide5.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide4.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide3.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    3/31

    Home

    The Way in which Programs are Executed in .NET

    .NET ClassLibrary

    Compiled intoassembly

    Common Language Runtime(CLR)

    Compiled into native code

    Executes

    User

    .NET Framework

    Welcome

    DLL(in MSIL)

    .NET Application code is compiled into MicrosoftIntermediate

    Lang

    uage (MSIL) and stored into a file called DLL.Applications

    that run under Common Language Runtime (CLR

    an executionengine ) are called managed Code as it provides

    JIT. At runtime the Assembly is compiled to its final state by

    the CLR.

    While running the CLR provides memorymanagement,type-safety checks, and other run-time tasks for

    the Application.

    1

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    4/31

    Home

    Introduction to Asp.NET

    q ASP.NET is a part of theMicrosoft .NET strategy

    for Web development.

    q It is a Web development platformthat provides

    the services necessary fordevelopers to build

    enterprise-class Web applications.

    q It applies an object-oriented

    2

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    5/31

    Home

    Welcome

    ServerResources

    :

    Welcome.aspx

    /imgData Store...

    Executable

    Server

    Returns Response3

    ReceivesRequest1

    ComposesResponse2

    An Asp. Net Web application response from server resources

    Overview

    3

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    6/31

    Home

    ASP.NET Features

    Supports multiple programminglanguagesASP.NET

    VB.NET C# JScript

    Otherlanguages

    supports

    Web Application

    4

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    7/31

    Home Advantages of ASP.NET

    q A new development interfaceunder Visual

    Studio.NET.

    q Separation of code andpresentation logic for better

    understanding and maintenance.q Extensive language support like

    Visual Basic .NET, C#, Jscript

    and ADO.NET.

    5

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    8/31

    Home

    Internet Information Services(IIS)

    Detail Overview

    Server resources:

    Welcome.aspxFindTitles.aspx

    System.aspx/imgPubs Database...

    WelcomeWeb.configStyle Sheet

    (CSS)

    IIS ReturnsResponse3 Application composesResponse2

    IIS Starts Application1

    Asp. Net Web application parts interaction on a Web

    Server

    6

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    9/31

    Home

    Page files are text files with anextension .aspx or .ascx

    Implements application logic using

    server-side code

    Presents information to the user in

    Asp.NET page structure

    7

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    10/31

    Home ASP.NET Pages

    WebForm.aspx WebForm.aspx.cs

    WebForm

    Visual component(Usually ContainsHTML and JScript)

    Logic (codebehind)

    User interface in thebrowserBoth files together make up a WebForm

    Static Text and Controls

    8

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    11/31

    Home Page Directives

    @Page: Defines page-specific attributes used by the ASP.NET page parser

    and compiler. Can be included only in .aspx files.

    @Control: Defines control-specific attributes used by the ASP.NET

    page parser and compiler. Can be included only in .ascx files (user controls).

    @Import: Explicitly imports a namespace into a page or user control.

    @Implements: Declaratively indicates that a page or user control

    implements a specified .NET Framework interface.

    @Register: Associates aliases with namespaces and class names,

    allowing user controls and custom server controls to be rendered when

    included in a requested page or user control

    @Assembly: Declaratively links an assembly to the current page or user

    control.

    @OutputCache: Declaratively controls the output caching policies of a

    page or user control.

    @Reference: Declaratively links a page or user control to the current

    page or user control.

    9

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    12/31

    Home Event handlers

    An Event handler is a subroutinethat

    executes code for a given event.

    Events are raised during eachstage of a

    Web Form processing.The event handler that correspondsto

    the raised event runs.

    10

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    13/31

    Home Web form page life cycle

    Stage Event Raised

    Page_Init

    Page Load

    Validate

    Form event handler

    Page_Unload

    Page_PreRender

    PageInitialization

    User CodeInitialization

    Validation

    EventHandling

    Before Pagerendering

    Cleanup

    Some events are fired automatically by thepage during

    some specific stages of page processing.Others thatare associated with server controls are

    triggeredon the client but are fired and handled on the

    server.

    11

    12

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    14/31

    Home Script section

    Script section

    Server-side script Client-side script

    Executed by the server Executed by the browser

    C#

    VB

    Jscript

    12

    13

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    15/31

    Home Client side script

    They are part of a page and are sent to

    the browser which executes them when a

    user requests the page.

    Typically used to:Change the appearance of the page when it is

    loaded in the browser

    Perform validation on the data entered by the

    user in a form

    Display relevant information in the browser

    13

    14

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    16/31

    Home Server side scripting

    Code can be contained in eitherserver-

    side code declaration

    blocks or render blocks .

    ASP.NET supports server-side code

    in any

    language that targets the runtime.

    Server-side code declaration blocksmust

    14

    15

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    17/31

    Home

    Every request in ASP.NET isprocessed by an

    HttpHandler

    For example, ASPX pages arehandled by the default

    ASPX Page HttpHandler.You can create your ownHttpHandler to render

    content based on the request

    Http handlers

    HttpModules are Similar to ISAPI FiltersThey are built using .NETThe Integrate with the ASP.NET RequestPipeline

    o The Pipeline is over 20 events thatfire during the processing of arequest.

    Used to Catch the Request and React as

    needed.o URL Rewritingo Securityo Logging

    Http Modules

    15

    16

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    18/31

    Home server Controls

    HTML controls

    1.

    Flexible controls.2. Not many features.3. Used when the form runs in the client

    side and user does not need manyfeatures to be incorporated.

    4. Useful when porting ASP applicationsto ASP.NET.

    Web controls

    1. Rich features that enable programmingof controls

    2. Large variety of controls present.3. Used when the form runs

    in the server side.4. Better functionality to handle data

    stored in the database5. Useful in visual design environments.

    16

    17

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    19/31

    Home Web server controls

    q ASP.NET provides a set of object-oriented GUI

    components known as Web Server

    Controls todesign and develop a web

    application apart from the

    HTML controls generally used todesign web

    applications.

    17

    18

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    20/31

    Home Web server controls

    The AutoPostBack property can be found in all webserver

    controls which post back their data to the serverwhen the

    form is posted or when a button is clicked.

    The EnableViewState property can be found in allweb server

    controls and is used to define whether a controlsViewState or

    the present value it contains is to be retained in thecontrol

    after the form is posted back to the server.

    Web Server Controlscan be classified as:

    Text Entry Controls

    18

    19

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    21/31

    Home

    Namespaces

    Using the Request Object

    Using the Response Object

    Retaining value of Variables

    Session and Application State Variables

    Configuration Files

    Web.config File

    Working with web objects

    19

    20

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide22.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide24.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide25.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide26.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide27.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide28.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide30.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide30.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide28.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide27.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide26.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide25.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide24.xmlhttp://opt/scribd/conversion/tmp/scratch16023/slide22.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    22/31

    Home

    Namespaces :

    System.Web : The Application, Browser, Cache, Cookies,Exception, Request,Response, Server, and Trace Objects. Use these Classes in

    most Web

    Programming tasks. The Application object defined inGlobal.asax is based onthe Application class.

    System.Web.SessionState : The Session object. Theseclasses are used to

    retrieve and save items in Session state. System.Web.Services : The WebService object. Theseclasses are referred tocreate and use Web Services.

    System.Web.UI : The Page and Control objects. Theseclasses are used in

    Namespaces are a way of organizing code. They provideprotection from

    conflicting names, sometimes called namespace collisions.This protection is

    especially necessary in large projects in which it is very easyfor two items

    to accidentally have the same name. By organizing your codeinto namespaces,

    you reduce the chance of these conflicts.

    collection of similar classesNamespaces

    TopicHome

    20

    Working with web objects

    20

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    23/31

    Home

    The Page Object Controls yourApplications user Interface. The Page objecthas properties and methods that provideaccess to other objects in the user interface.

    The Page base class provides the coremethods and properties that you usefrequently when programming Web forms.

    Cache

    Controls

    Page

    Request

    Response

    Server

    Session

    Trace

    Working with web objects

    20

    21

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    24/31

    Home

    The RequestObject contains theinformation sent by the client

    browser when a page is requestedfrom the application. The Requesthas properties and methods that

    provide access to other objects thatmake up the request, as shown inthe figure.

    The HttpRequest objectenca sulates information that the

    Working with web objects

    Using the Request Object

    Request

    Browser

    ClientCertificates

    Cookies

    Files

    InputStream

    Determine the Capabilities ofthe Browser making the

    request. Browser propertiesprovide the browser version

    number, determine if itsupports cookies, and supply

    other Information.

    Authenticate the Client

    Get Information from theclient in the form of Cookies

    Get Files that are Uploadedby the Client

    Read and Write to the rawdata sent in the request

    TopicHome

    21

    22

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    25/31

    Home Working with web objects

    Using the Response Object

    The Response Object contains theinformation sent by the client

    browser when a page is requestedfrom the application. The Requesthas properties and methods that

    provide access to other objectsthat make up the request, asshown in the figure.

    HttpResponse object gives thedevelo er access to the out ut

    Response

    Cache

    Cookies

    Output

    Determine how the servercaches responses beforethey are sent to the clientSet the Content of cookies to

    send to the client

    Get or set the raw datareturned to the client as the

    response

    TopicHome

    22

    23

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    26/31

    Home

    Web forms are created anddestroyed each time a clientbrowser makes a request. Becauseof this characteristic, variables

    declared within a Web form do notretain their value after a page isdisplayed. To solve this problem,

    Asp. Net provides the followingways to retain variable betweenrequests:

    Working with web objects

    Context.Handlerobject : This object is used to retrievepublic members of one Web forms class from a

    subsequently displayed Web form.Query strings : This is used to pass information betweenrequests and responses as part of the Web address. Theyare visible to the user, so they should not contain secureinformation such as passwords.Cookies : They are used to store small amounts ofInformation on a Client. Client might refuse cookies, sothe code has to anticipate that possibility.

    View State : ASP. Net stores items added to a pagesViewState property as hidden fields on the page.Session state : The Session state variables are used tostore items that you want to keep local to the currentsession ( single user ).Application state : TheApplication state variables tostore items that you want to be available to all users of theapplication.

    TopicHome

    23

    24

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    27/31

    Home Working with web objects

    Page-level Object-levelVariables

    ApplicationLevel

    Session Level

    String ourname = nobel";Response.Write ("Welcome " +ourname);

    Global.asax

    * Stores event handlers for all events

    * Stored in the root directory of the application

    * Its location defines the boundary for the applicatio

    * Contains configuration settings for all

    applications.

    TopicHome

    24

    25

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    28/31

    Home

    Application and Session statevariables are created on

    the fly, without variable name ortype checking. We

    should limit the access points tothese variables.

    Maintaining Session state affectsperformance. Session

    state can be turned off at the

    Working with web objects

    Session & application state variables

    Session Management can bedone in3 ways :

    Inproc

    StateServer

    SqlServer

    InProc is the default and easiestmethod. Its a good entry-level

    and yet still powerful way tomaintain state. Its also very

    performant. Data in thesession is stored in the same

    memory space as theapplication.

    The StateServer is a Windowsservices that operates

    independently of the web sitesapp domain. Objects do require

    serialization, however,performance is very good. Thestate server can live on one of

    the web servers, and other webservers can point to it so theclient can connect to multipleservers and receive the same

    state.

    The most powerful comes fromSQL Server as a state server. It

    involves a bit of overhead due toserialization and data retrieval,however, the performance is stillquite good. Many customersalready have large/redundant SQLdeployments, so leveraging this

    infrastructure is an advantage.

    TopicHome

    25

    26

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    29/31

    Home Working with web objects

    Type of Tag Rule

    Tag and attribute

    names

    Camel-case : The first character of a tag name islowercase and the first letter of any subsequentwords are in uppercase.

    Attribute values

    Pascal-case : The first character is uppercase and the

    first letter of any subsequent concatenated words isuppercase. Exceptions being true and false, whichare in lowercase.

    qConfiguration files are stored in plain text, which enablesweb developers

    to edit them in any text-editor of their choice.q The ASP.NET configuration files are written in XML, whichenables the

    developer to modify them using an XML parser tooq

    If the configuration settings are changed, they areautomatically detectedby the system. The server need not be restarted.

    DirectorySubDirectory

    q Each directory can actually override the configuration of

    the previousdirectory by creating its own configuration file.q The clients cannot view the contents of the configurationfiles using a

    browser, thus, ensuring security.

    Configuration files

    Configuration Files

    Machine.Config Web.Config

    It sets properties applicablefor the entire server,and

    is an XML based file

    Contains property settings justfor a single application or

    even may be a single directory

    of an application.

    Server Configuration File

    TopicHome

    26

    27

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    30/31

    Home Working with web objects

    Configuration files

    Web Pages

    Set thePropertyValues

    Application

    ConfigurationFile

    Web.Config

    This web.config is an XML

    based file

    Web.Config FileStructure

    RootDirectory

    OfApplication

    Web Config

    An application is configuredusing the web.config file which resides in the root director

    of the application.

    TopicHome

    27

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml
  • 8/8/2019 MCAPresentation

    31/31

    Home

    Thanking You . . .

    Amit Sharma

    Kanhaiya Kumar Jha

    Pawan Mishra

    Sayanta Basu

    Sribas Das

    Tanmoy Guha

    A word of thanks . . .

    http://opt/scribd/conversion/tmp/slides/slide2.xmlhttp://opt/scribd/conversion/tmp/slides/slide2.xml