View
215
Download
0
Category
Tags:
Preview:
Citation preview
MSIS 5133 Advanced MIS - E-Commerce
Spring 2003
Lecture 4: The DotNET Framework – Part 1
Dr. Rathindra SarathyDr. Rathindra Sarathy
Contents
Part 1Part 1 Server-side programming – Microsoft Scripting Server-side programming – Microsoft Scripting
ModelModel Server-side programming – Java ModelServer-side programming – Java Model Disadvantages of Server-side ScriptingDisadvantages of Server-side Scripting The DotNet FrameworkThe DotNet Framework
Server-Side Programing – Microsoft Scripting Model
Needed to activate components on the Needed to activate components on the serverserver
Used to interact with databasesUsed to interact with databases Important middle-tier technologyImportant middle-tier technology Used to maintain application and session Used to maintain application and session
state.state. Used to pass results back to client-tierUsed to pass results back to client-tier
Browser with
Script Engine
HTMLClient-side
ScriptsActiveX Controls
XML
Internet
Webserver (IIS) = http server + ASP
Script Engine
SQL ServerDatabase
COM+ 2.0 COM Objects & Transaction
Management
http requests
http requests
Win 2000 Server
HTMLXML
Server-side Scripts
http responses
http responses
Active Server Pages (ASP) Contains server-side script but may also contain Contains server-side script but may also contain
HTML and client-side scriptHTML and client-side script Only the server-side scripts are executed on the Only the server-side scripts are executed on the
server server Web server sends files with .asp extension to the ASP Web server sends files with .asp extension to the ASP
engine (asp.dll) engine (asp.dll)
ASP - Example Form Collection – for forms using POST method (Example2.asp)Form Collection – for forms using POST method (Example2.asp)<% option explicit %><% option explicit %><% response.buffer = "true" %><% response.buffer = "true" %><html><head><title>Student Login Form</title></head><html><head><title>Student Login Form</title></head><body bgColor = "#C0C0C0" text = "#009011"><h1 align = "center">Student Login Form</h1><body bgColor = "#C0C0C0" text = "#009011"><h1 align = "center">Student Login Form</h1><% if <% if request.formrequest.form("txtName") <> "Student" or ("txtName") <> "Student" or request.formrequest.form("txtPass") <> "qwerty" then %>("txtPass") <> "qwerty" then %>
<<form method="post" name="frmC" action="Example2.aspform method="post" name="frmC" action="Example2.asp">"><input type="text" name="txtName" size="20">Your Name<br><br><input type="text" name="txtName" size="20">Your Name<br><br><input type="password" name="txtPass" size="20">Your Password<br><br><input type="password" name="txtPass" size="20">Your Password<br><br><input type="submit" value="Login" name="btnSubmit"><input type="submit" value="Login" name="btnSubmit"><input type="reset" value="Clear" name="btnReset"><input type="reset" value="Clear" name="btnReset"></form></form>
<% else %><% else %><% dim strName, strPassword, strForm<% dim strName, strPassword, strFormstrName = request.form("txtName")strName = request.form("txtName")strPassword = request.form("txtPass") strPassword = request.form("txtPass") strForm = request.form %>strForm = request.form %><h3 align="center">Hi There <% = strName %> !</h3><h3 align="center">Hi There <% = strName %> !</h3><br><% = strForm %> <br><% = strForm %>
<% end if %><% end if %></body></html></body></html>
ASP Objects
•Request: Used by Web Server to retrieve information sent by client browser (such as from a form)•Response: Used by Web Server to send information to client browser. •Session begins when browser makes first request for an ASP page. Session object can store data (like visitor name, address etc.) & share information between a single client and Web Server during the session. Session ends when session timeout is reached or user closes browser.•Application = sequence of Web pages. The Application object allows information to be shared among all users of an ASP application.•Server: Used to access the Web server’s properties and methods and instantiate objects (including 3rd party objects) on the server•ASPError: Used to obtain information about last error that occurred using GetLastError method of ASPError object.
From Kalata Book – Page 251
Components Piece of compiled, executable code that defines objects properties, Piece of compiled, executable code that defines objects properties,
methods & encapsulates entire codemethods & encapsulates entire code Improves reusability - only need to know interfacesImproves reusability - only need to know interfaces COM (Component Object Model) is a Microsoft standard for interface COM (Component Object Model) is a Microsoft standard for interface
specificationspecification Allows independent components written by third parties to interface and Allows independent components written by third parties to interface and
work with each otherwork with each other Original code could have been in any language including C++, VB, etc. – Original code could have been in any language including C++, VB, etc. –
compiled into an executable componentcompiled into an executable component ASP can handle both ASP can handle both built-inbuilt-in and and third-partythird-party components. You could components. You could
write your own component and often had to for e-commerce write your own component and often had to for e-commerce applications.applications.
ASP Built-in COM components
From Kalata Book – Page 365
Server-Side programming – Java ModelBrowser
User Interface
Applets & Javabeans with Script & HTML
Internet
Webserver TomCat
Database
BusinessLogic
Servlets & EJB (Enterprise
JavaBeans) with JSP
Unlike VB, Java code can run directly in the browser (or server),
under JVM. Therefore, it provides more
options, including Common Gateway
Interface (CGI) type program
Java Servlets
Java programs that run on the server – they Java programs that run on the server – they are not contained in web pages, like applets are not contained in web pages, like applets are.are.
It is like a CGI (Common Gateway Interface) It is like a CGI (Common Gateway Interface) program, but is not compiled to machine program, but is not compiled to machine language codelanguage code
Portability is an advantagePortability is an advantage Runs in the JVM (Java Virtual Machine) of web Runs in the JVM (Java Virtual Machine) of web
server, and so needs to be loaded only once. server, and so needs to be loaded only once. Available for subsequent many accesses.Available for subsequent many accesses.
Can be specified to be pre-loaded into web Can be specified to be pre-loaded into web server when it starts up.server when it starts up.
import java.io.*;import java.util.Date;import javax.servlet.*;import javax.servlet.http.*;public class TodayServlet extends HttpServlet { public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { response.setContentType( "text/HTML" ); response.setHeader( "Pragma", "no cache" ); response.setHeader( "Cache-Control", "no cache" ); response.setHeader( "Expires", "0" ); PrintWriter out = response.getWriter(); out.println( "<HTML>" ); out.println( "<head>" ); out.println( "<title>Today</title>" ); out.println( "</head>" ); out.println( "<body>" ); out.println("<h1>The current date and Time is:</h1>" ); Date today = new Date(); out.println( "<p>" + today + "</p>" ); out.flush(); out.println( "</body>" ); out.println( "</HTML>" ); }}
SERVLET - Example
Java Servlets (continued)
1
6
2
3 4
5
Browser
Web Server
Servlet Engine
Other Servershttp://../servlet/..
DBMS
1. Client issues http request2. Web server sends request to
servlet engine3. Servlet engine can call other
objects4. Servlet engine can also
connect to DBMS and/or other servers
5. Servlet engine runs Java program and generates (HTML) output
6. Web server redirects output to browser
JSP – Java Server Pages A JSP is (like an ASP) an HTML document with embedded Java CodeA JSP is (like an ASP) an HTML document with embedded Java Code Easier to write HTML code (with several standard editors) than Java Easier to write HTML code (with several standard editors) than Java
Servlet code to write the output to browserServlet code to write the output to browser Separation of HTML and Java code allows specialists to work on eachSeparation of HTML and Java code allows specialists to work on each Separates presentation (HTML) from processing logic (Java)Separates presentation (HTML) from processing logic (Java)
<html><html><head><head><META NAME="Pragma" CONTENT="no-cache"><META NAME="Pragma" CONTENT="no-cache"><META NAME="Cache-Control" CONTENT="no-cache"><META NAME="Cache-Control" CONTENT="no-cache"><META NAME="Expires" CONTENT="0"><META NAME="Expires" CONTENT="0"><title>Today</title><title>Today</title></head></head><%@ page import="java.util.*" %><%@ page import="java.util.*" %><body ><body ><H1> The current date and time is:</h1><H1> The current date and time is:</h1><p> <%= new Date( ) %> </p><p> <%= new Date( ) %> </p></body></body></html></html>
JSP - continued
1
6
2
3
4
5Browser
Web Server
Servlet Engine
http://../servlet/..
HTML / JSP pages
Redirect
Page Compile
1. Browser brings up URL2. GET or POST method is part of HTTP Request3. Input from form is processed, along with database and other
requests4. All this information from Form (http request) is Redirected to JSP
page5. The Page compile process converts the JSP into a servlet. Servlet is
run by JSP engine6. Web Server redirects the HTML page output generated by JSP-
generated servlet to browser
JavaBeans & Enterprise JavaBeans (EJB)
The Bean concept is similar to the COM concept and EJB to The Bean concept is similar to the COM concept and EJB to DCMDCM
A Java Bean is a reusable software component that can be A Java Bean is a reusable software component that can be visually manipulated in builder tools. visually manipulated in builder tools.
Beans can be purchased for Java from 3rd parties.Beans can be purchased for Java from 3rd parties. Primary purpose of beans is to enable the visual construction Primary purpose of beans is to enable the visual construction
of Java applications. of Java applications. EJB are server-side software components in distributed EJB are server-side software components in distributed
environments within containersenvironments within containers
Characteristics & Disadvantages of Server-side Scripting
ASPASP Very basic development processVery basic development process
HTML and Server-side scriptHTML and Server-side script No compiling — it is interpretedNo compiling — it is interpreted Easy exception handling — On Error ResumeNextEasy exception handling — On Error ResumeNext Simple languages - VBScript or Jscript(ECMA JavaScript))Simple languages - VBScript or Jscript(ECMA JavaScript))
Fairly sophisticated capabilitiesFairly sophisticated capabilities Supports/Supports/RewardsRewards use of COM objects use of COM objects Transactioining possibleTransactioining possible
Bad pointsBad points ASP functionality is limited (lightweight object model) ASP functionality is limited (lightweight object model) Script and content unavoidably intermixedScript and content unavoidably intermixed Session(user) state problematic at best Session(user) state problematic at best No sophisticated error handlingNo sophisticated error handling Configuration and deployment is difficultConfiguration and deployment is difficult
A “Compiled ASP” = ASP.NET
Figure 1-3 Compiling the ASP.NET page and the code behind the page into Figure 1-3 Compiling the ASP.NET page and the code behind the page into the the Page class Page class
Why DotNet? Changes to counteract Java and provide same features:Changes to counteract Java and provide same features:
Platform Independence (CLR and MSIL vs. JRE and Java Platform Independence (CLR and MSIL vs. JRE and Java bytecode)bytecode)
Improved Resuability through Base Classes (New Base Improved Resuability through Base Classes (New Base Classes)Classes)
Changes to improve VB in relation to Java (VB.NET)Changes to improve VB in relation to Java (VB.NET) Consistent Object OrientationConsistent Object Orientation
Changes to accommodate Multiple LanguagesChanges to accommodate Multiple Languages C#, VB.NET, etc.C#, VB.NET, etc.
Changes to improve functionality and performanceChanges to improve functionality and performance ASP.NET (Compilation and Caching)ASP.NET (Compilation and Caching)
Changes to address weaknesses in development, debugging Changes to address weaknesses in development, debugging and deploymentand deployment XCOPYXCOPY Visual Studio.NETVisual Studio.NET
Changes to accommodate XML throughoutChanges to accommodate XML throughout ADO.NET ADO.NET Web ServicesWeb Services
The .NET Framework
Figure 1-10 The .NET FrameworkFigure 1-10 The .NET Framework
The .NET Framework
ASP.NET is used to develop dynamic Web ASP.NET is used to develop dynamic Web applications within the .NET Frameworkapplications within the .NET Framework
The .NET Framework consists of:The .NET Framework consists of:
A Common Language Runtime (CLR) A Common Language Runtime (CLR)
A hierarchical set of Base Class Libraries A hierarchical set of Base Class Libraries (BCL) (BCL)
The .NET Framework is the architectural model The .NET Framework is the architectural model for creating programs that interface with the for creating programs that interface with the operating system and the base class librariesoperating system and the base class libraries
Changes to counteract Java and provide same features
•Java has the Java Virtual Machine which can run bytecode and is therefore (hardware/software) platform independent (.NET’s answer is CLR). CLR will be able to convert multiple languages (C#, VB.NET, C++, Java, even COBOL!) into and (interpreted) Microsoft Intermediate Language (MSIL) similar to bytecode, which can then be JIT compiled into native code of the machine. The compiler calls CLR routines directly to do this. JVM can JIT compile Java bytecode into native code.
Java uses JRE (Java Runtime Environment) to convert bytecode to machine code. In the case of DotNET, multiple runtime hosts can use CLR such as ASP.NET, IE, Windows Shell, VBA and WinForms designer
•The transition from C and C++ to Java is relatively straightforward – (the .NET platform includes support for C# called “Csharp” to encourage C++ users to use .NET)
•The transition from regular Java programs to applets and servlets is relatively smooth, whereas the transition from VB to COM and ActiveX is not. Also, involves the problems of needing access to server for registering and the “DLL Hell” problem – (.NET answer is to introduce VB.NET with true object-oriented features such as inheritance, overloading and polymorphism)
•Does not have a set of standard class libraries that Java has – (.NET classes are being standardized)
The Base Class Libraries
The base class libraries are commonly used code The base class libraries are commonly used code providing general functions that can be accessed providing general functions that can be accessed from any applicationfrom any application
Libraries contain fundamental code structures and Libraries contain fundamental code structures and methods that allow you to communicate with the methods that allow you to communicate with the operating system software and other applicationsoperating system software and other applications
By storing commonly used code in libraries, the By storing commonly used code in libraries, the code can be reused across applicationscode can be reused across applications
The actual library of code is located in one or more The actual library of code is located in one or more dynamic link library filesdynamic link library files For example, the code for accessing a database For example, the code for accessing a database
object is stored in the Database class library, located object is stored in the Database class library, located in the file called System.Data.dllin the file called System.Data.dll
Namespace
The base class libraries are organized into logical The base class libraries are organized into logical groupings of code called namespaces groupings of code called namespaces
A namespace is a hierarchical way to identify A namespace is a hierarchical way to identify resources in .NETresources in .NET
The System object is at the top of the The System object is at the top of the namespace hierarchy, and all objects inherit namespace hierarchy, and all objects inherit from itfrom it ASP.NET: System.Web namespaceASP.NET: System.Web namespace WebForms: System.Web.UI namespaceWebForms: System.Web.UI namespace HTML Server Controls: HTML Server Controls:
System.Web.UI.Control.HTMLControlSystem.Web.UI.Control.HTMLControl ASP.NET Server Controls: ASP.NET Server Controls:
System.Web.UI.Control.WebControlSystem.Web.UI.Control.WebControl
.NET Base Class LibraryNamespace Description Example Classes
System Contains all the basic types used by every app.
Object, Buffer, Byte, Char, Array, Int32, Exception, GC, String
System Collections
Contains types for managing collections of objects
ArrayList, BitArray, Dictionary, Hashtable, Queue, SortedList, Stack
System Data Contains basic database management types DataBinding, DataRelation, DataRow, DataSet, DataTable,DataSource
System Globalization
Contains types for National Language Support (NLS), String compares, and Calendars
Calendar, CultureInfo, JulianCalendar, NumberFormatInfo, NumberStyles, RegionInfo
System IO Contains types that allow synchronous and asynchronous reading and writing to data streams
ByteStream, File, FileStream, MemoryStream, Path, StreamReader, StreamWriter
.NET Base Classes (continued)System.Net Contains types that allow for network comm WebRequest, WebResponse, TcpClient, TcpListener,
UdpClient, Sockets
System Reflection
Contains types that allow the inspection of metadata
Assembly, ConstructorInfo, FieldInfo, MemberInfo, MethodInfo, Module, ParameterInfo
System Runtime.Remoting
Contains types that allow for managed remote objects
ChannelServices, RemotingServices, IMessage, IMessageSink
System Security
Contains types that enable security features Permissions, Policy, Principal, Util, Cryptography
System Web.UI.WebControls
Contains types that enable rich user interface controls for Web-based applications
AdRotator, BorderStyle, DataGrid, HyperLink, ListBox, Panel, RadioButton, Table
System WinForms
Contains types that enable rich user interface controls for desktop applications
Button, CheckBox, DataGrid, FileDialog, Form, ListBox, MainMenu, MonthCalendar, NewFontDialog, RichEdit, ToolBarTreeView
Importing Namespaces
Visual Studio .NET adds references to your Visual Studio .NET adds references to your projects’ commonly used namespaces by defaultprojects’ commonly used namespaces by default
You can import the namespaces into your page You can import the namespaces into your page using the @Import directiveusing the @Import directive
The following is the syntax for importing a .NET The following is the syntax for importing a .NET namespacenamespace
<%@ Import NamespaceName %><%@ Import NamespaceName %> Below is a sample of how you would import the Below is a sample of how you would import the
ASP.NET Page classASP.NET Page class
<%@ Imports System.Web.UI.Page %><%@ Imports System.Web.UI.Page %>
The .NET Framework
2. Base Class Library2. Base Class Library
Common Type SpecificationCommon Type Specification
1. Common Language Runtime1. Common Language Runtime
3. ADO.NET: Data and XML3. ADO.NET: Data and XML
VBVB C++C++ C#C#V
isual S
tud
io.N
ET
Visu
al Stu
dio
.NE
T
4.ASP.NET: Web Services4.ASP.NET: Web Servicesand Web Formsand Web Forms
JScriptJScript ……
WindowsWindowsFormsForms
Framework Services
Common Language Runtime
Visual Studio .NET and the Visual Studio .NET and the Common Language Common Language RuntimeRuntime are language independent are language independent
Language independence is achieved via the use of Language independence is achieved via the use of the Common Language Runtime (CLR)the Common Language Runtime (CLR)
The CLR supports new features such as a The CLR supports new features such as a Common Common Type System (CTS),Type System (CTS), Garbage Collection (GC), and an Garbage Collection (GC), and an Intermediate Language (IL)Intermediate Language (IL)
The Common Type System (CTS) requires that all The Common Type System (CTS) requires that all applications built within .NET, including ASP.NET applications built within .NET, including ASP.NET applications, support the same basic data typesapplications, support the same basic data types Examples of data types are strings and integersExamples of data types are strings and integers These common data types are derived from the These common data types are derived from the
System namespaceSystem namespace
Common Language Runtime
The compiled code is transformed into an The compiled code is transformed into an intermediate language called the intermediate language called the Microsoft Microsoft Intermediate Language (MSIL Intermediate Language (MSIL oror IL) IL)
An integer in Visual Basic .NET or an int in C# are An integer in Visual Basic .NET or an int in C# are converted to the same .NET data type, which is Int32converted to the same .NET data type, which is Int32
The IL that is created is the same for all languagesThe IL that is created is the same for all languages The The assemblyassembly is the compiled .NET program is the compiled .NET program The assembly contains the IL along with additional The assembly contains the IL along with additional
information called information called metadatametadata Metadata contains information about the assemblyMetadata contains information about the assembly Use the IL Disassembler (ildasm.exe) to view the IL Use the IL Disassembler (ildasm.exe) to view the IL
within an assemblywithin an assembly
VBVBSource Source codecode
CompilerCompiler
C++C++C#C#
CompilerCompilerCompilerCompiler
AssemblyAssemblyMSIL CodeMSIL Code
AssemblyAssemblyMSIL CodeMSIL Code
AssemblyAssemblyMSIL CodeMSIL Code
Operating System ServicesOperating System Services
Common Language RuntimeCommon Language Runtime
JIT CompilerJIT Compiler
Native CodeNative Code
ManagedManagedcodecode
UnmanagedUnmanagedComponentComponent
Changes to accommodate Multiple LanguagesCommon Language RuntimeExecution Model
Source CodeSource CodeSource CodeSource Code
C++, C#, VB or any .NET languageC++, C#, VB or any .NET language
csc.exe or vbc.exe csc.exe or vbc.exe only convert to MSILonly convert to MSIL
CompilerCompiler
AssemblyAssemblyDLL or EXEDLL or EXE
Common Language RuntimeCompilation
MetadataMetadataMetadataMetadata
MSIL (MSIL (Intermediate LangIntermediate Lang.) .) Managed Managed
codecode
MSIL (MSIL (Intermediate LangIntermediate Lang.) .) Managed Managed
codecode
ResourcesResourcesResourcesResources
ParcelTracker.DLLParcelTracker.DLL
An assembly is a group of resources and types, along with metadata about those resources and types, that is deployed as a unit.
The Programmable Web Web Services Provides Building Blocks for the Microsoft .NET Framework
Type DescriptionsType Descriptions
ClassesClassesBase classesBase classesImplemented interfacesImplemented interfacesData membersData membersMethodsMethods
ClassesClassesBase classesBase classesImplemented interfacesImplemented interfacesData membersData membersMethodsMethods
NameNameVersionVersionCultureCulture
NameNameVersionVersionCultureCulture
Assembly DescriptionAssembly Description
Other assembliesOther assembliesSecurity PermissionsSecurity PermissionsExported TypesExported Types
Other assembliesOther assembliesSecurity PermissionsSecurity PermissionsExported TypesExported Types
Metadata in an Assembly
Type Information– Automatically bound into
assembly Inseparable Stored in binary format
– Describes every class type
– Used by VS.NET IntelliSense™
Viewing the Assembly
Create a simple class, compile the class into an Create a simple class, compile the class into an assembly, then view the class using the IL assembly, then view the class using the IL DisassemblerDisassembler
Open Notepad and type the code shown:Open Notepad and type the code shown:' hello.vb - displays hello world ' hello.vb - displays hello world ' Created 06/01/2002' Created 06/01/2002Imports SystemImports SystemPublic Module HelloPublic Module Hello
Sub Main()Sub Main()Dim s1 As String = "1 - Dim s1 As String = "1 -
Hello World" Hello World" Console.WriteLine(s1)Console.WriteLine(s1)
End SubEnd SubEnd ModuleEnd Module' Run this at the command line' Run this at the command line' vbc hello.vb' vbc hello.vb
Using the ILDASM to View the Assembly and Classes
Figure 1-13 Using the ILDASM to view the assembly and classesFigure 1-13 Using the ILDASM to view the assembly and classes
Compiling a Program
Save the file as "hello.vb" in your c:\Inetpub\wwwroot Save the file as "hello.vb" in your c:\Inetpub\wwwroot directorydirectory
Open the .NET Command PromptOpen the .NET Command Prompt Change to your c:\Inetpub\wwwroot using the cd c:\Change to your c:\Inetpub\wwwroot using the cd c:\
Inetpub\wwwroot commandInetpub\wwwroot command Type vbc hello.vb and press Enter key. This compiles Type vbc hello.vb and press Enter key. This compiles
your program into an executable file named hello.exe in your program into an executable file named hello.exe in the same folderthe same folder
Type hello at the command prompt and hit the Enter Type hello at the command prompt and hit the Enter Key. The program runs and displays the hello world Key. The program runs and displays the hello world stringstring
Type ILDASM hello.exe. View the compiled assembly Type ILDASM hello.exe. View the compiled assembly using the IL Disassemblerusing the IL Disassembler
Garbage Collection
Programs that don’t release references to objects Programs that don’t release references to objects cause memory leakscause memory leaks
Memory leaks occur when memory is no longer being Memory leaks occur when memory is no longer being used by the application, but cannot be reassigned to used by the application, but cannot be reassigned to another objectanother object
In .NET, the Common Language Runtime uses the In .NET, the Common Language Runtime uses the garbage collector to manage memorygarbage collector to manage memory
The Garbage Collection (GC) process is the process of The Garbage Collection (GC) process is the process of allocating and managing the reserved memoryallocating and managing the reserved memory
Because of the garbage collection process, .NET Because of the garbage collection process, .NET applications have fewer problems with memory leaks applications have fewer problems with memory leaks and circular references than current Windows and circular references than current Windows applicationsapplications
Common Language Runtime - Goals Cross-language integrationCross-language integration, - Enable deep multi-language integration - Code written in one , - Enable deep multi-language integration - Code written in one
language can now inherit implementation from classes written in another language;language can now inherit implementation from classes written in another language; Self-describing componentsSelf-describing components – Metadata packed with executable (called assemblies) means that – Metadata packed with executable (called assemblies) means that
different applications may use different versions of an assemblydifferent applications may use different versions of an assembly Easier software updatesEasier software updates Easier software removalEasier software removal
Simple Deployment and VersioningSimple Deployment and Versioning - Because assemblies are self-describing, no explicit - Because assemblies are self-describing, no explicit registration with the operating system is required. Application deployment can be as simple as copying registration with the operating system is required. Application deployment can be as simple as copying files to a directory tree. files to a directory tree. Removal on registration dependencyRemoval on registration dependency Safety – fewer versioning problemsSafety – fewer versioning problems THE END of ‘DLL Hell’THE END of ‘DLL Hell’
Integrated security servicesIntegrated security services - Since the runtime is used to load code, create objects, and make - Since the runtime is used to load code, create objects, and make method calls, the runtime can perform security checks and enforce security policy as managed code method calls, the runtime can perform security checks and enforce security policy as managed code is loaded and executedis loaded and executed code access securitycode access security, developers can specify the required permissions their code needs to , developers can specify the required permissions their code needs to
accomplish work e.g., permission to write a file or access environment variables. Information accomplish work e.g., permission to write a file or access environment variables. Information stored in assembly level, along identity of the codestored in assembly level, along identity of the code
Role-based securityRole-based security - permissions based on user identity - runtime determines what roles the - permissions based on user identity - runtime determines what roles the user is a member of and then grants permissions based on those roles.user is a member of and then grants permissions based on those roles.
Caching Support ASP.NET provides built-in caching support that enables re-use of ASP.NET provides built-in caching support that enables re-use of
work work
Cache Engine: Extensible Cache APICache Engine: Extensible Cache API Enables arbitrary objects to be cachedEnables arbitrary objects to be cached
Full Page CachingFull Page Caching Vary by params, language, user-agent (browser)Vary by params, language, user-agent (browser)
Partial Page CachingPartial Page Caching Enables portions of pages to be cachedEnables portions of pages to be cached
Web Service CachingWeb Service Caching Vary by parameters and methodsVary by parameters and methods
Changes to address weaknesses debugging and deployment - Debugging using TRACE
Page and Application tracingPage and Application tracing Easy to include “debug” statements Easy to include “debug” statements Add trace directive at top of page - <%@ Page Trace=“True” %>Add trace directive at top of page - <%@ Page Trace=“True” %>
Add trace calls throughout pageAdd trace calls throughout page Trace.Write(“MyApp”, “Button Clicked”)Trace.Write(“MyApp”, “Button Clicked”) Trace.Warn(“MyApp”, “Value: “ + value)Trace.Warn(“MyApp”, “Value: “ + value)
Collect request detailsCollect request details Server control treeServer control tree Server variables, headers, cookiesServer variables, headers, cookies Form/Querystring parametersForm/Querystring parameters
Access page from browserAccess page from browser Access tracing URL within appAccess tracing URL within app
http://localhost/approot/Trace.axdhttp://localhost/approot/Trace.axd
Changes to address weaknesses debugging and deployment - Deployment using XCOPY
ASP.NET enables a web app to be deployed simply by copying its bits to the server - \bin ASP.NET enables a web app to be deployed simply by copying its bits to the server - \bin directory registrationdirectory registration
Deployment for components:Deployment for components: xcopy/ftp to an application’s “\bin” dir xcopy/ftp to an application’s “\bin” dir No registration required (no more regsvr32)No registration required (no more regsvr32)
Web apps are isolated from each otherWeb apps are isolated from each other Components can be private to applicationComponents can be private to application Other apps cannot load private componentsOther apps cannot load private components Other apps can use different component versionsOther apps can use different component versions
Uninstall ?— just delete directoryUninstall ?— just delete directory No-nonsense architectureNo-nonsense architecture
No local server access requiredNo local server access required No web server restarts requiredNo web server restarts required
Works for all web app resourcesWorks for all web app resources Web Pages/ Web ServicesWeb Pages/ Web Services Compiled ComponentsCompiled Components Configuration MetadataConfiguration Metadata
Recommended