Build Web Applications with Visual Studio - PowerPoint PPT Presentation

About This Presentation
Title:

Build Web Applications with Visual Studio

Description:

Carlotta Eaton www.nr.vccs.edu/eaton Associate Professor of IST New River Community College Slides by Microsoft Modified by Carlotta Eaton Agenda Web Forms ASP ... – PowerPoint PPT presentation

Number of Views:86
Avg rating:3.0/5.0
Slides: 33
Provided by: SeanCa7
Learn more at: https://www.nr.edu
Category:

less

Transcript and Presenter's Notes

Title: Build Web Applications with Visual Studio


1
Build Web Applications with Visual Studio .NET
  • Carlotta Eaton www.nr.vccs.edu/eaton
  • Associate Professor of IST
  • New River Community College
  • Slides by Microsoft
  • Modified by Carlotta Eaton

2
Agenda
  • Web Forms
  • ASP.NET Applications
  • Caching

3
Session Prerequisites
  • Experience with Visual Basic 6.0, Visual Basic
    .NET, Visual C or Visual C, Visual Basic
    Scripting Edition
  • Experience developing Web Applications

Level 200
4
Agenda
  • Web Forms
  • ASP.NET Applications
  • Caching

5
Web FormsActive Server Pages .NET
  • Part of the .NET Framework
  • ASP.NET builds, deploys, and runs Web
    applications and services
  • Visual Studio .NET Web applications support
    ASP.NET directly

VB
C
C
Perl
Python

Web Services
User Interface
ASP.NET
ADO.NET Data and XML
Base Framework
Common Language Runtime
6
Web Forms ASP.NET Page Framework
  • New control-based, event-driven execution model
    for Web UI
  • Visual Basic for the Web
  • Much less code required than ASP
  • Cleanly encapsulated functionality
  • Executed via CLR as native code
  • Visual Basic, C, JScript
  • ASP.NET pages use .ASPX extension
  • Runs side-by-side on Internet Information Server
    with current ASP applications

7
Web Forms Part Declarative, Part Code
  • A Web Form combines declarative tags (HTML, ASP
    directives, server controls and static text) with
    code
  • However, good separation provided between code
    and tags

Visual Studio .NET
single file
separate files
lttagsgt
lttagsgt
code
code
Form1.aspx
Form1.aspx
Form1.vb
8
Web Forms Page Event Life Cycle
Page is loaded and initialized
Page_Load
Control Events
Textbox1_Changed
1. Change Events
Button1_Click
2. Action Events
Page_Unload
Page is disposed
9
Web FormsServer Controls
  • 45 Built In Controls
  • Target any HTML 3.2 browser
  • Raise Events to Server
  • Basic Controls
  • textbox, checkbox, radio, button
  • Advanced Controls
  • AdRotator, Calendar, DataGrid, Validator

10
Web Forms Server Controls
  • Declared as HTML or XML tag with runatserver
    attribute
  • Examplesltinput typetext idtext2
    runatservergt
  • ltaspcalendar idmyCal runatserver/gt
  • Tag name identifies control to create
  • Control is implemented as .NET object
  • ID attribute provides programmatic accessor

11
Web FormsBasic Server Controls
  • ltasptextbox idtext1 runatserver/gttext1.text
    Hello World
  • ltaspcheckbox idcheck1 runatserver/gtcheck1.chec
    kedTrue
  • ltaspbutton idbutton1 runatserver/gtonclickbutt
    on1_onClick()
  • ltaspDropDownList idDropDownList1
    runatservergtDropDownList1.SelectedItem.Text
    Hello

12
Web FormsServer Side Events
  • ltaspbutton idButton1 runatserver
  • onClickButton1_Clickgt
  • ltaspDropDownList idDrpDwn1 runatserver
    OnSelectedIndexChangedDrpDwn1_ItemSelectedgt

13
Agenda
  • Web Forms
  • ASP.NET Applications
  • Caching

14
ASP.NET ApplicationsSaving Application State
  • Essentially global variables for the application
  • Application(CompanyName)
  • Can lock or unlock Application State Variables
  • Application.lock
  • Application(GlobalCounter) NewValue
  • Application.unlock

15
ASP.NET ApplicationsSaving Session State
  • Per User Variables
  • Available to All Pages in the Site
  • Session(UserID) 5
  • UserID Session(UserID)

16
ASP.NET ApplicationsASP versus ASP.NET State
  • ASP Session State
  • Forces Server Affinity
  • Dependent on cookies
  • Not fault tolerant
  • ASP.NET Session State
  • Support for Web Gardens and Server Farms
  • Doesnt require cookies
  • Better fault tolerance

17
ASP.NET ApplicationsConfiguring Session State
  • Configuration information stored in Web.Config
  • ltsessionState
  • modesqlserver
  • cookielessfalse
  • timeout20
  • sqlConnectionStringdata source127.0.0.1user
    idsapassword
  • stateConnectionString"tcpip127.0.0.142424" /gt
  • lt/sessionStategt

18
ASP.NET ApplicationsConfiguring Session State
  • Mode
  • InProc Conventional session variables. Stored
    in-memory on the web server
  • StateServer Sessions are stored on an external
    server, in memory
  • SqlServer Sessions are stored in a SQL database
  • Cookieless
  • Determines if Cookieless sessions should be used
  • Values are true or false
  • TimeOut
  • Determines the default timeout for the web site

19
ASP.NET ApplicationsConfiguring Session State
  • sqlConnectionString
  • contains the datasource, userid, and password
    parameters necessary to connect to a sql database
    that holds the session state
  • connectionString
  • Contains information needed to connect to the
    state server

20
ASP.NET ApplicationsStoring Data in SQL Server
  • In order to setup the SQL Server to store state
    information you must run a small T-SQL script on
    the target server
  • InstallSQLState.sql can be found in
    sysdrive\winnt\Microsoft.NET\Framework\version
  • Creates the following on the server
  • A database called ASPState
  • Stored Procedures
  • Tables in TempDB to hold session data.
  • Uninstall is via
  • UninstallSQLState.sql

21
Agenda
  • Web Forms
  • ASP.NET Applications
  • Caching

22
CachingPage Output Caching
  • Pages That Dont Change Frequently
  • Dramatic Performance Increase
  • lt_at_ OutputCache Duration "500
    VaryByParamnone gt

23
Caching Fragment Caching
  • Dynamic Portions of a Page
  • Data Doesnt Change Frequently
  • User Control

Site Header
lt_at_ OutputCache Duration60 VaryByParmnone gt
Navigation
Page Body
Caches only the page body for the specified
duration
24
Caching Cache APIs
  • Programmatically Cache Data
  • Cache.Insert( _
  • Key, _
  • Value, _
  • CacheDependency, _
  • AbsoluteExpiration, _
  • SlidingExpiration, _
  • Priority, _
  • PriorityDecay, _
  • Callback)

25
Caching Cache APIs
  • Key
  • String used to look up the cached item
  • Value
  • Item or object to store in the cache
  • CacheDependency
  • Cache item can automatically expire when a file,
    directory, or other cache item changes

26
Caching Cache APIs
  • AbsoluteExpiration
  • Cache item can expire at some fixed time
    (midnight, for example)
  • SlidingExpiration
  • Cache item can expire after a certain amount of
    inactivity
  • Priority
  • When forcing items from the cache, which items
    should go first
  • PriorityDecay
  • Within a given priority range, does this item
    expire fast or slow

27
Session Summary
  • Visual Studio .NET ASP.NET Visual Basic for
    the Web
  • Drag-drop-double-click
  • Event-driven, control-based encapsulation
  • Target any client, or specific clients
  • Big runtime benefits over ASP
  • Fast native code execution
  • Hassle-free deployment
  • Baked-in support for security, Web Farms,
    out-of-proc Session state, etc.

28
For More Information
  • MSDN Web site at
  • msdn.microsoft.com
  • Microsoft Official Curricula (MOC)
  • Introduction to ASP.NET
  • Course 2063
  • Programming the .NET Framework with Visual Basic
  • Course 2415
  • Microsoft Press
  • Introducing Microsoft .NET

29
MSDNEssential Resources for Developers
Subscription Services
Library, Professional, Universal Delivered via
CD-ROM, DVD, Web
OnlineInformation
MSDN Online, MSDN Flash
Training Events
MSDN Training, Tech-Ed, PDC, Developer Days,
MSDN/Onsite Events
Print Publications
MSDN Magazine MSDN News
MembershipPrograms
MSDN User Groups
30
Web Forms Demonstration 1
31
Questions And Answers
32
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com