SlideShare a Scribd company logo
1 of 197
1
2 
Index 
1. .Net Introduction 
2. Asp.Net Introduction 
3. Controls 
4. State Management 
5. Asp.Net Objects 
6. Asp.Net Web Application 
7. Assembly 
8. Caching 
9. Security 
9. Debugging 
10. Tracing 
11. Web Services 
12. AJAX
3
4 
Contents 
1. .Net Introduction 
2. The Origins of .Net Technology 
3. The .Net Framework 
4. .Net Languages 
5. Benefits Of The .Net Approach
5 
.Net Introduction 
Definition: 
.Net is a software framework that includes everything required for 
developing software for web services 
 It integrates presentation technologies,component technologies 
and data technologies on a single platform. 
 Microsoft took many of the best ideas in the industry,added their 
own creativity and innovations and produced a coherent systems 
solution popularly known as Microsoft .NET 
Microsoft .Net Platform Includes 
1. .NET infrastructure and Tools 
2. .Net user experience 
3. .Net building block 
4. .Net device Software
The Origins Of .Net Technology 
The current technology of .Net has gone through three significant phases of 
6 
development : 
1. OLE Technology 
2. COM Technology 
3. .NET Technology 
OLE Technology: 
 To embed documents from one applications into another application. 
 To enable one application to manipulate objects located in another 
application 
Ex:MS Word and MS Excel 
COM Technology 
 Reduces the overall complexity of software 
 Enables distributed development across multiple organizations or 
departments 
 Enhances Software Maintainability 
.NET Technology 
 Third-Generation Component Model 
 It Provides a new level of inter-operability compared to COM technology. 
 It Uses Intermediate language(MSIL)for compilation.
7 
.Net Framework 
The .Net framework is one of the 
tools provided by the .NET 
infrastructures and tools component 
of the .NET platform. 
.Net platform provides a new 
environment for creating and running 
robust,scalable and distributed 
applications over the web. 
Definitions 
The .NET framework provides an 
environment for building,deploying 
and running web services and other 
applications. 
The Main components are 
•Common Language Runtime(CLR) 
•Framework Base Classes 
•User and program interfaces. 
Click Here to Enlarge
Common Language Runtime(CLR) 
8 
The CLR is the core of the.NET 
framework and is responsible for loading 
and running C# programs 
•The common Language Runtime,popularly 
known as CLR is the heart and soul of 
the .NET framework. 
•It is runtime environment in which 
programs written c# and other .NET 
languages are executed. 
•It also supports Cross-Language 
Interoperability 
The CLR provides a number of services 
that include 
Loading and execution of programs 
Memory isolation for applications 
Verification of type safety 
Compilation of IL into native executable 
code 
Providing metadata 
Memory Management 
Enforcement of security 
Interoperability with other systems 
Managing exceptions and errors 
Support for tasks such as debugging 
and profiling 
Click Here To Enlarge
9 
CLR Components 
Common Type System(CTS) 
The .Net frame work provides multiple language support using the feature known 
as Common Type System that is built into the CLR.The CTS supports a variety of 
types and operations found in most programming languages and therefore calling 
one language from another language does not require type conversions. 
Common Language Specification 
The common Language specification defines a set of rules that enables 
interoperability on the .NET Platform.These rules serve as a guide to third-party 
compiler designers and library builders.The CLS is a subset of CTS and therefore 
the languages supporting the CLS can use other’s class libraries as if their 
own.Application Program Interface(APIs) that are designed following the rules of 
CLS can easily be used by all the .NET Languages. 
Microsoft Intermediate Language(MSIL) 
MSIL,or simply IL,is an instruction set into which all the .NET programs are 
compiled.It is akin to assembly language and contains instructions for 
loading,storing,initializing and calling methods.When we compile a C# program or 
any program written in CLS-Compliant language,the source code is compiled into 
MSIL 
Managed Code 
As we know,the CLR is responsible for managing the execution of code compiled 
for the .NET platform.The code that satisfies the CLR at runtime in order to 
execute is referred to as managed Code.Compilers that are compatible to the .Net 
platform generate managed code.
10 
Framework Base Classes 
.Net supplies a library of base classes 
that we can use to implement 
applications quickly.We can use them by 
simply instantiating them and invoking 
their methods or by inheriting them 
through derived classes,thus extending 
their functionality. 
Much of the functionality in the base 
framework classes resides in the vast 
namespace called System 
The system namespaces included 
Input/Output Operations 
String Handling 
Managing arrays,lists,maps,etc 
Accessing files and file systems 
Accessing the registry 
Security 
Windowing 
Window messages 
Database Management 
Evaluation of mathematical 
functions 
Drawing 
Managing errors and exceptions 
Connecting to the internet and etc.. 
Click Here To Enlarge
USER AND PROGRAM INTERFACES 
The .NET framework provides the following tools for managing user-and 
11 
application interfaces: 
•Windows Forms 
•Web Forms 
•Console Applications 
•Web Services 
These tools enable users to develop user-friendly desktop-based as 
well as web-based applications using a wide variety of languages 
on .NET platform
12 
.NET Languages 
The .NET framework is language neutral.Currently,we can use a number of 
languages for developing .NET applications.They include: 
Native to .NET 
• C#(Specially created for .NET) 
• C++ 
• Visual Basic 
• Jscript 
Third Party Languages 
•COBOL 
•Eiffel 
•Perl 
•Python 
•SmallTalk 
•Mercury 
•Scheme 
All .NET languages are not created equal.Some Can use the components of 
the other languages,some can use the classes produced in other languages to 
create objects,and some languages can extend the classes of other languages 
using the inheritance features in .NET
Benefits Of The .NET Approach 
 Simple and faster systems development 
 Rich object model 
 Enhanced built-in functionality 
 Many different ways to communicate with the outside world 
 Integration of different languages into one platform 
 Easy deployment and execution 
 Wide range of scalability 
 Interoperability with existing applications 
 Simple and easy-to-build sophisticated development tool 
 Fewer bugs 
 Potentially better performance 
13
14
15 
Contents 
1.Classic ASP 
1.1 Classic ASP Success/Demerits 
1.2 A New Asp.Net Era 
2.System Architecture 
2.1 Application Architecture overview 
2.2 Building a 3-Tier Architecture 
2.3 Asp.Net Web Application Architecture 
3.Asp.net features 
4.Asp.Net Web Pages 
4.1 Asp.Net Web Form 
4.2 Event Flow 
4.3 Asp.Net code Changes 
5.Asp.Net Execution 
5.1 Asp.Net Execution Model 
5.2 Compilation and Execution 
5.3 Multimedia Execution
“Classic” ASP 
Demerits 
16 
“Classic” ASP 
Successes 
• Simple procedural 
programming model 
• Access to COM Objects 
– ADO 
– File system object 
• No compiling, just save 
• Support for multiple scripting 
languages 
• Mix HTML and code 
• VBscript – leverage Visual 
Basic skills 
•Tied tightly into IIS 
•Not Really Cross-platform 
–Solutions exists for Apache 
& Linux 
•Not easy to implement 
•Can only use Visual Basic or Java 
•Script Language – must be 
interpreted
17 
“Classic” ASP 
Challenges 
• Code readability 
• Coding overhead 
• Post Back complexity 
• Reuse 
• Performance 
• DLL locking 
• Deployment 
• Sessions 
• Caching
SSyysstteemm AArrcchhiitteeccttuurree?? 
18 
A New Era – ASP.NET 
• A complete rewrite of the original ASP 
– Kept the best concepts from ASP 
• your code from the HTML 
– Separates the programming logic from the look of the page 
– Program in ANY 
.NET language 
– Better tools, debugging 
• Pre-fabricated controls 
– Similar to Windows controls 
• Built-in security mechanisms 
• session management 
• Just-in-time compilation 
– No server restarts required 
• Settings stored in XML 
Its mainly based on the 3-Tier System Architecture
19 
System Architecture 
Single tier Architecture 
Presentation,Business logic and data logic all are present in the 
same layer,which normally runs on a stand-alone system.e.g., C,C++ 
applications. 
Two tier Architecture 
Presentation and business logic will be present in one layer and 
data logic will be available in a separate layer.Example: Client-Server 
application. 
Three-tier Architecture 
Presentation,Business logic and data logic all are present in 
different layers.Asp.Net are developed using 3-tier architecture. 
N-tier Architecture 
Presentation,Business logic and data logic all are present in 
different layers.Business logic may present in multiple layers. Web 
Applications using external services are developed using n-tier architecture. 
E.g. Remoting and web services ( Weather forecasting ).
Application Architecture overview 
Presentation 
20 
Distributed 
Presentation 
Business 
Logic 
Data 
Three-Tier 
Presentation 
Business 
Logic 
Data 
Business 
Logic 
Data 
Monolithic 
Presentation 
Business 
Logic 
Data 
Client/Server 
Presentation 
Business 
Logic 
Data 
Click Here To Enlarge
21 
Building a 3-Tier Application 
Presentation Tier 
This Tier is responsible for communication with the users and web 
service consumers and it will use objects from Business Layer to response GUI 
raised events. 
Logical Tier 
This is the brain of the 3-Tier Application. Some architects do not make 
any distinction between Business Tier and Data Access Tier. 
Some of the advantages are 
 Increases code transparency 
 Supports changes in Data Layer. You can change or alter database with 
out touching the Business Layer and this would be a very minimum touch up. 
Data Tier 
This Tier is responsible for retrieving, storing and updating the 
Information therefore this tier can be ideally represented through a commercial 
database. We consider stored procedures as a part of the Data Tier. Usage of stored 
procedures increases the performance and code transparency of an application.
ASP.NET Web Application Architecture 
22 
PPrreesseennttaattiioonn TTiieerr 
User Controls 
(.ascx) 
BBuussiinneessss LLooggiicc TTiieerr 
DDaattaa TTiieerr 
Graphic 
Files 
UI Pages 
(.htm) 
XML Web Services 
(.asmx) 
Code-Behind File 
(.aspx.vb or .aspx.cs) 
PPrrooxxyy AADDOO..NNEETT 
.NET 
Objects 
Data Source 
COM+ 
Services 
RRCCWW 
COM 
Objects 
Web Form 
(.aspx)
23 
ASP .NET Features 
ASPX, ASP – side by side 
Simplified programming 
model 
Simplified deployment 
Better performance 
Caching 
Security 
Powerful controls 
Simplified browser support 
Simplified form validation 
Code behind pages 
More powerful data access 
Web services 
Better session management 
No DLL locking 
No DLL registration 
Simplified configuration 
Page lets
24 
What Is a Web Form? 
.aspx extension 
Page attributes 
@ Page directive 
Controls save state 
Body attributes 
Form attributes 
<%@ Page Language="C#" 
Inherits=Project.WebForm1 %> 
<html> 
<body ms_positioning="Grid Layout"> 
<form id="Form1" method="post" 
runat="server"> 
</form> 
</body> 
</html> 
Enlarge 
Enlarge
25 
EEvveenntt ffllooww iinn AASSPP..NNEETT ppaaggeess 
((..aassppxx)) 
– Application Level Events (Global.asax) 
– Page_Init: page and controls are initialized 
– Page_Load: all the controls and page are loaded 
– Change events for controls are processed 
– Click events for controls are processed 
– Page_PreRender: page is about to render 
– Page_Unload: page is unloaded from memory 
The Page Directive 
Defines page-specific (.aspx file) attributes used by the ASP.NET page parser 
and compiler. 
Example showing an .aspx page mapped to its code behind: 
<%@ Page Codebehind="WebForm1.aspx.vb" 
inherits="AspNet.WebForm1" %>
26 
ASP.NET Coding Changes 
• Page directives 
– Language attribute must be in set the @Page directive 
• Structural changes 
– All functions and variables must be declared within a <script> 
block 
– Only one language per page 
– Render Functions are no longer supported; use Response.Write 
• Design-Time controls are no longer supported 
– Replaced with Web controls
27 
VViissuuaall BBaassiicc 
SSoouurrccee 
ccooddee 
CCoommppiilleerr 
CC## CC++++ 
CCoommppiilleerr CCoommppiilleerr 
AAsssseemmbbllyy 
IILL CCooddee 
AAsssseemmbbllyy 
IILL CCooddee 
AAsssseemmbbllyy 
IILL CCooddee 
CCoommmmoonn LLaanngguuaaggee RRuunnttiimmee 
JJIITT CCoommppiilleerr 
NNaattiivvee CCooddee 
OOppeerraattiinngg SSyysstteemm SSeerrvviicceess 
MMaannaaggeedd 
ccooddee 
UUnnmmaannaaggeedd 
CCoommppoonneenntt 
ASP.NET 
Execution Model
ASP.NET Runtime Compilation and Execution 
language Which? 
28 
default.aspx 
Native 
code 
C# 
Visual Basic .NET 
Visual Basic .NET 
compiler 
C# 
compiler 
MSIL 
JIT 
compiler 
Common Language Runtime 
HTML
Multimedia: ASP.NET Execution Model 
29
30
31 
Contents 
1.Introduction to Control 
1.1 Web form Vs HTML Controls 
1.2 Server Control 
1.2 Maintaining the state in Server Control 
1.3 How to Open The Application? 
2.Toolbox and its control types 
2.1 HTML Controls 
2.2 Web form Control 
2.3 Validation Control 
2.3 List Control 
2.4 Component 
2.5 Data Control
An ASP.NET control that helps you to transfer data between a dialog 
page and its invoker page. 
32 
Introduction Controls 
Types 
• Web Form Controls As 
Sever controls 
• Textbox, Label, 
Hyperlink, Etc 
• Dropdown List, Data 
Grid, Data List, Etc 
• HTML Controls (Client or 
Server) 
• ADO.NET Design 
Controls(Data Controls) 
• System Components 
• Validation Controls 
Properties 
window 
Controls
33 
Web Form Vs HTML Controls 
Both have the following benefits 
– An object model that you can program against on the server 
– A set of events for which you can write sever side event handlers. 
– The ability to handle events in client script . 
– Automatic maintenance of the control's state (View State). 
– Interaction with validation controls so you can easily verify that a user 
has entered 
appropriate information into a control. 
– Data binding to one or more properties of the control. 
– Support for HTML 4.0 styles if the Web Forms page is displayed in a 
browser that supports cascading style sheets. 
– Pass-through of custom attributes.
34 
What is a Server Control? 
<asp:Button id="Button1" runat="server" 
Text="Submit"/> 
• Runat="server" 
– Event procedures run on the server 
– View state saved 
• Properties and methods are available in server-side event 
procedures 
private void btn_Click(object sender, 
System.EventArgs e) 
{ 
lblName.Text = txtName.Text; 
} 
•Without code 
–Required field 
–Within range 
–Two fields equal (password) 
–Regular expressions 
–Validation error messages 
•With code, but simplified 
–Custom validation
Maintaining the State of ASP.NET Server Controls 
• Server control state is stored in __VIEWSTATE, a hidden control on 
the Web Form 
• VIEWSTATE stores state in a string value of name-value pairs 
35 
<form id="Form1" method="post" runat="server"> 
<input type="hidden" name="__VIEWSTATE" 
value="dDw3NzE0MTExODQ7Oz4=" /> 
'HTML here 
</form> 
On by default, adjustable at Web Form and control level 
<%@ Page EnableViewState="FFaallssee"" %%>> 
<asp:ListBox id="ListName" EnableViewState="true" 
runat="server"> </asp:ListBox>
Choose The Application what ever u want create 
36 
Visual C# Projects—Asp.Net Web Application
37 
Open The Web form 
Task Bar 
Toolbox 
Web Form 
Solution 
Explorer 
Properties Window
38 
HTML Coding 
Enlarge
39 
Code- 
Behind 
Enlarge
Toolbox:It Contains Collection of 
components or controls 
Using Tools: 
1.Just Drag And Drop in the Web form 
Asp.Net Toolbox: 
1.Web Forms-General Server Controls 
2.Data Controls:Used For Connectivity 
3.HTML Controls-As Like General controls like 
Textbox and Label etc.. 
40 
Toolbox
41
42 
HTML Controls 
HTML Controls: 
•This Control used general what we used before in 
html. 
•Here the control is not called as Server Control 
•While using this HTML Control we should convert as 
Server Control in our ASP.Net Application 
HTML Coding 
<DIV style="DISPLAY: inline; HEIGHT: 
15px"ms_positioning="Flow Layout">Label</DIV>
Converting HTML Control to Asp.Net Sever Control 
Control 
Drag and Drop the html control in web 
form 
Select the control 
Right Click the control and mark as 
“Run As Server Control” 
Now the control changed as Server 
Control 
HTML Control convert as Server Control 
<DIV style="DISPLAY: inline; Z-INDEX: 
101; HEIGHT: 
“76px"ms_positioning="Flow Layout" 
id="DIV1" runat="server">Label</DIV> 
43
44
Web Controls(As Server Controls) 
45 
Web Form Controls 
General Controls List Controls Validation Controls 
Ex:Textbox,Radio 
Button Ex:Data Grid,Data list 
Ex:Required Field,Range Field, 
Compare Field
46 
General Controls 
This Control is used for general purpose as like 
inserting and updating 
Ex:Label,Textbox,Dropdown List etc..
TEXTBOX:Its mainly used for getting input values from the users 
Id for textbox 
control(ex:txtename) 
To Set Maximum Length For a 
control(ex:if set 10 it allows 10 
characters only) 
•Single-General 
•Multiple-When More Number of 
values entered (ex:Address) 
•Password-When We enter 
password character(ex:**** ) 
In Coding: 
TextBox1.Text=“hay”; 
47
Label:Its mainly used for give identification(ex:a book having label) 
Set id for the 
label(lblename) 
Set Font Style for the 
Control(ex:bold) 
Set some text for 
label(ex:Enter Ename) 
48 
Coding: 
Label1.Text=“hay”;
Button:It used to perform some Action as like event(ex:Button Click) 
Set some styles for Button 
49 
Button ID 
Enter Some Text for 
Button 
Events for button
50 
Link Button:Its used redirect one page to another page 
Id for Link Button 
Enter some text for Link 
Button 
Using response object the 
page should be redirected
Set some alternative messages 
for image 
51 
Image Button:As Like Button control with some images 
Id For imagebutton(ex:imgbtn) 
Browse the image and select it 
When image button is 
clicked the textbox shoes 
the messages
52 
Dropdown List:Adding multiple values(Ex:Date Of Birth) 
The is First way adding 
value in control 
(Dropdown-properties-items- 
collection-set text- 
Add-ok)As shown in 
fig(Ex:Month in DOB I.e 
Constant string Values) 
The second way adding 
value is coding as 
shown(ex:numeric values-day& 
month in DOB)
List Box:Adding Multiple values with multiple selection 
1.Adding values in List Box (List Box 
-properties-items-collection-set text- 
Add-ok)ex:Select More than area 
1.Single:For selecting single value 
2.Multiple:For selecting more than 
one using Ctrl Key 
Coding used for select the values 
from the control 
53
54 
Hyperlink:Make a link to next page 
This is to link one page 
to other page(Browse the 
url and select it) 
Text for hyperlink 
control
Checkbox List:Its used to check more than one value from the control 
Adding values through 
collections 
This for selecting the value from 
the control. 
For selecting more than one values 
we should do for loop to make of 
multiple values 
55
Radio Button List:Its used to select the single value from the 
control 
As like other controls its also 
used add values in 
collections.In This control is 
used select the particular or 
singular value at a time. 
Ex:Select the Gender(male or 
Female) 
Display values as vertical 
This for selecting the value 
from the control. 
56
57 
Calendar:Display the current calendar in specified formats 
Represents the style 
for calendar control 
Getting values from the 
calendar control
58
59 
Validation Controls 
•The validation control is used to check 
some condition for the control. 
•This control is activate as Server Control
Control Name Description 
RequiredFieldValidator Ensures that the user does not skip an entry. 
60 
CompareValidator 
Compares a user's entry with a constant value or a property 
value of another control using a comparison operator (less 
than, equal to, greater than, and so on). 
RangeValidator 
Checks that a user's entry is between specified lower and 
upper boundaries. You can check ranges within pairs of 
numbers, alphabetic characters, or dates. Boundaries can be 
expressed as constants. 
RegularExpressionValidator 
Checks that the entry matches a pattern defined by a 
regular expression. This type of validation allows you to 
check for predictable sequences of characters, such as those 
in social security numbers, e-mail addresses, telephone 
numbers, postal codes, and so on. 
CustomValidator 
Checks the user's entry using validation logic that you code 
yourself. This type of validation allows you to check for 
values derived at run time. 
Validation Summary Displays the validation errors in summary form for all of the 
validators on a page.
RequiredFieldValidator:Its is used to validate the function must to 
enter the field.Ex:Mandatory 
61 
Textbox 
Required Field Validator 
control 
Specified which control to be 
validate(ex:Textbox1) 
Enter some error message that 
should displayed
CompareValidator:This used to compare two values should be same or not. 
Ex:Compare new and confirm Password 
Specify which control to 
compare 
Specify which control to 
validate 
Enter some messages to 
displayed 
62
RangeValidator:Check the range value(Ex:Minimum and Maximum value) 
Specify which control to 
validate 
Enter the maximum range 
value 
Enter The minimum range 
value 
63
Validation Summary:Its display the full error summary (Ex:yahoo new user 
registration form) 
For displaying error 
message format 
Select whether the the 
summary should be shown are 
not 
64
RegularExpressionValidator:Its used to specify some expressions as like 
email,phone numbers 
Enter the some error 
message 
In validation 
Expression select 
some expression what 
u need 
65
66
67 
List Controls 
The List controls belongs to web controls..The 
controls are 
1. DataGrid 
2. DataList 
3. Repeater 
These controls are used select single/all 
the values from the database and display 
with some style formatting
68 
Data Grid 
Displays data as a table 
Control over 
Alternate item 
Header 
Footer 
Colors, font, borders, 
etc. 
Paging 
Updateable 
Item as row 
Data grid contains auto 
format to display the grid 
effectively,For these Data 
Grid->Right Click->Auto 
Format->Select the style 
formats as our wish
In the data Grid we can set paging,sorting and column designing using the Data 
Grid->Right Click->Property Builder->Columns 
69 
Data Grid 
In Columns it contain 
Bound Column 
Used to Give valid 
Column Name 
Button Column 
In-built button like 
edit,cancel,select 
Hyperlink 
Give Link to other Page 
Template Column 
Add extra column 
ex:check box 
Data grid get source 
from dataset
70 
Data List 
Data List controls should as like data grid but without in-built button column 
•Directional rendering 
•Good for columns 
•Item as cell 
•Alternate item 
•Updateable 
Styles: 
In Data List it contains some pre-defined styles and alternating styles for display. 
In These every thing should be included in <item template> 
We can set the styles in HTML with tags or else dragging controls in <item 
template>
71 
Data List 
For Binding values in data grid 
Its also take source from the dataset 
In Code-Behind Page_Load() 
In HTML Page 
In HTML page the column values should bind inside the 
item template tag and with other tags ex:table,label etc..
72 
Repeater 
The repeater control is static one and does not have any user 
interfaces 
List format 
No default output 
More control 
More complexity 
Item as row 
Not updateable 
In HTML 
Compare to data list control it have only 
limited formatted style
73 
Repeater 
In Web Form Page_Load( ) 
As like other List Control it take source from Dataset 
In HTML Page 
The column value should bind inside in item template and 
with data binder tag
74 
components 
The components are used add some 
functionality built –in as component 
Ex:Timer
75
76 
Data Controls 
•CCoonnnneeccttiioonn 
•CCoommmmaanndd 
•DDaattaaRReeaaddeerr 
•DDaattaaSSeett 
•DDaattaaAAddaapptteerr 
•DDaattaaVViieeww
77 
Data Controls 
DDaattaabbaassee 
CCoonnnneeccttiioonn AAAAuuuuttththhhoooorrrsrsss 
DDaattaaAAddaapptteerr 
DDaattaaSSeett 
SSeelleecctt …… ffrroomm AAuutthhoorrss 
AAuutthhoorrss
DDaattaabbaassee 
78 
Data Controls 
CCoonnnneeccttiioonn PPPPuuuubbbblliillsisisshhhheeeerrrrssss 
DDaattaaAAddaapptteerr 
DDaattaaSSeett 
SSeelleecctt …… ffrroomm PPuubblliisshheerrss 
AAuutthhoorrss 
PPuubblliisshheerrss
79 
Data Controls 
DDaattaasseett 
AAuutthhoorrss 
PPuubblliisshheerrss 
DDaattaa VViieeww 
DDaattaa GGrriidd 
RReeppeeaatteerr 
DDaattaa LLiisstt
80
81 
Contents 
1. Into to State Management 
2. Client State Management 
1.1 Cookies 
1.2 Query String 
1.3 View State 
3. Server State Management 
3.1 Application 
3.2 Session 
3.3 Database Support
82 
Introducing State Management 
State Management is a process of maintaining in application and 
session-related information when multiple users request for the 
same or different web pages of an Asp.Net application. 
State Management needed when the same user logs on to a web 
site for multiple times. 
In addition ,state management includes maintaining page-level 
information during the round trip of a Web Form page. 
Types 
1.Client Side Management 
2.Server Side Management
83 
State Management Types 
1.Client side Management 
• View State 
• Cookies 
• Query Strings 
2.Server side Management 
• Application 
• Session 
• Database Support
84 
View state 
The View state in an Asp.Net Web Form enable to retain page and control-specific 
values between round trips.Each web form and the controls on the page 
have the view state property that is inherited from the base control class.Asp.Net 
Frame work uses the view state property to automatically save the values of the 
page and each control prior to rendering the page. 
The view state is implemented with a hidden form field called _VIEWSTATE,which 
is automatically created in every web form .When Asp.Net executes a web page on 
a web server ,the values stored in the view state property of the page and 
controls on it are collected and formatted into a singe encoded string.The 
encoded string is then assigned to the value attribute of the hidden form field 
_VIEWSTATE and is sent to the client as a part of the web page.When the page is 
posted back to the server,the Asp.Net Framework parses the view state string at 
page initialized and restores the property information in the page 
By default the view state is enabled ,if we need we can disabled for a particular 
control. 
Advantages: 
The view state stored in a standard HTML format as a part of the web page. 
Easy to implement 
The Values in view state are hashed,compressed and encoded for Unicode 
implementation 
Disadvantages 
Page speed is slow when datas are high 
Security Less
Cookies 
•A cookie is a small file that the server embeds on the user's computer .Each time 
the same computer requests a page with a browser, it will send the cookie 
too.Cookies can be either temporary or persistent.temporary cookie is exist in 
memory space of a browser,when the browser is closed,all the temp cookies lost.A 
persistent cookie is saved as a text file in the file system of the client computer. 
•Benefits Of Cookies 
•No server resources are required as they stored in client 
•They are light weight 
•Simple to use 
Limitations Of Cookies 
Most Browsers place a 4096-byte limit on the size of a cookie,although support for 
8192-byte cookie is becoming more common in the new browser and client-device 
versions available today. 
•Some users disable their browser or client device’s ability to receive 
cookies,thereby limiting the use of cookies 
•Cookies can be tampered and thus creating a security hole. 
•Cookies can expire thus leading to inconsistency
Query String Benefits 
•When we need to submit information back to a web page or another page by using 
URL .A query string provides a simple way to pass information from one page to 
another page. 
•The Query String is used to store and transfer the information through the URL. 
•It get the values from the Request Object. 
•No server resources are required.This query string containing in the HTTP requests 
for a specific URL 
•All browsers support query strings 
Query String Limitations 
•Query String data is directly visible to user thus leading to security problems 
•Most browsers and client devices impose a 255-character limit on URL length.
87 
Session 
Session State is a collection of objects that are stored in the memory of the web 
server. 
But where is the Session State stored? 
In II5, Session State is stored in the memory of the process aspnet_wp.exe. In IIS6, 
by default all applications share the same application pool, i.e. the session state is 
stored in the memory of the process w3wp.exe 
The advantages of using session state are as follows: 
· Process independence 
· Ease of implementation 
· Durability 
· Scalability 
The disadvantages of using session state are: 
· Low Performance for large volumes of data 
· Overhead involved for serializing and de-serializing the Session data 
Session state in ASP.NET can be stored in one of the following three ways. 
• InProc 
• State Server 
• SQL Server
Asp.Net provides state as means of storing global application-specific information 
in the application state is is stored in a key-value pair and is used to maintain 
data consistency between server round trips and between pages. 
•The Application object is used to store and access variables from any page, just 
like the Session object. 
•The difference is that ALL users share one Application object, while with 
Sessions there is one Session object for EACH user. 
• The Application object should hold information that will be used by many pages 
in the application 
•Application variables can be accessed and changed by any page in the 
application. 
•You can create Application variables in "Global.asax" 
88 
Application
Database support 
Database support is used to combination with cookies or session state.For 
ex,for an e-commerce web site ,you can maintain state information by using 
a relational database. 
Advantages 
1. Security 
2. Consistency 
3. Personalization 
Disadvantages 
1. Data base for state management involves complex hardware and software 
configurations 
2. The web site may go down poor construction of the relational data model 
that is used to support session state in a web application.
90
91 
Contents 
1.Page And its Life Cycle 
2.Request And Response 
3.Session And Application 
4.Demo:Using the objects in 
application
92 
Page Life Cycle 
Page_Init: 
During this event, you can initialize values or connect any event handlers that 
you may have. 
Page_Load: 
During this event, you can perform a series of actions to either create your 
ASP.NET page for the first time or respond to client-side events that result from a 
post. The page and control view state have been restored prior to this event. Use the 
IsPostBack page property to check whether this is the first time that the page is 
being processed. If it is the first time, perform data binding. Also, read and update 
control properties. 
Page_DataBind: 
The DataBind event is raised when the DataBind method is called at the page 
level. If you call DataBind on individual controls, it only fires the DataBind event of 
the controls beneath it. 
Page_PreRender: 
The PreRender event is fired just before the view state is saved and the 
controls are rendered. You can use this event to perform any last minute operations 
on your controls. 
Page_Unload: After a page has finished rendering, the Page_Unload event fires. This 
event is a good place to perform final cleanup work. This includes items such as the 
cleanup of open database connections, discarding objects, or closing those files that 
are open.
93 
Response and Request objects 
• Response 
Response object is used to send output to the user from the server 
– Represents the client browser 
– Response.Redirect(“Webform2.aspx”) 
– Response.Cookies[“Username”] = “Bob” 
• Request 
Request object is used to get information from the user 
– Represents the server 
– Request.PhysicalApplicationPath 
– Username = (String)Request.Cookies[“Username”]
94 
Session and Application 
variables 
Session variables 
– Hash table-style collection of name-value pairs 
– Remembered until the client closes the browser (or the session timeout 
expires – default 20 minutes) 
– Only for one client 
– Session[“Valid User”] = true 
Application variables 
– Hash table-style collection of name-value pairs 
– Always remembered 
– For all clients 
– Application[“NumClients”] = NumClients + 1
95
96 
Open The Asp.Net Web Application And Choose the Web Form 
Webform1
97 
Create Table And Place The Controls 
Tables $Controls
In Code-Behind Write Coding For Creating Cookies,Session And Query String 
Session 
Cookies 
98 
Query String
Select the Another Web Form And Place The Controls 
99
In WebForm2 Code Behind Write the coding how to retrieving the values from 
cookies,session and Query String 
100 
Session 
Cookies 
Query String
101 
Type The Values As 98,99 how it transform to next page
Ya ..Now it Get Back The values From First page Using These Objects 
102
103 
Create Web form And write in page_load( ) event application Object 
Application 
Object
104 
In First time the count shows 1
After Refreshing the the page the count should be increased(Now its 3) 
105 
Enlarge
106
107 
Contents 
1. Global.Asax File 
1.1 Global Programming 
2. Web.Config file 
2.1 Session Variables 
3. Business Objects
108 
ASP.NET Web Applications 
• Global ASAX 
– Application_Start 
– Application_End 
– Session_Start 
– Session_End 
• Session 
• Application
109 
Global Programming (Global.asax) 
• Define Application Global methods, constants, variables 
• Global Event Handling 
– Application_Start 
– Session_Start 
– Application_Begin Request 
– Application_Authenticate Request 
• Useful for setting up custom Page.User and roles 
– Application_Error 
– Session_End 
– Application_End
110 
The Web.config file 
• Configuration management for ASP.NET 
• XML file 
• Hierarchical structure 
MMaasstteerr ssyysstteemm 
mmaacchhiinnee..ccoonnffiigg 
AApppp AA wweebb..ccoonnffiigg AApppp BB wweebb..ccoonnffiigg 
AApppp BB ssuubbddiirr 
wweebb..ccoonnffiigg
111 
web.config 
• Site configuration file 
• Like an .INI file for your site 
• XML format 
• Extensible 
• Some settings 
– Security 
– Session 
– Localization 
– Tracing 
– Debugging
112 
Session Variables 
• Store state information 
• No longer require cookies 
• Share between servers 
<sessionState 
mode=“StateServer“ 
stateConnectionString="tcpip=127.0.0.1:42424" 
sqlConnectionString="data source=127.0.0.1; 
user id=sa;password="cookieless="false" 
timeout="20" 
SessionState/>
113 
Business Objects 
• Not registered 
– Placed in ./bin directory 
• Not locked 
– Shadow copy
114
115 
Contents 
1.Introduction about Assembly 
2.Assembly Architecture 
3. Manifest Functions 
4. Single/Multi File Assembly 
5.Assembly Types 
5.1 Private Assembly 
5.2 Public Assembly 
5.3 Global Assembly Cache 
6.Assembly Location
116 
ASSEMBLY 
Assemblies are the building blocks of .NET Framework applications 
It form the fundamental unit of deployment, version control, reuse, activation 
scoping, and security permissions. 
An assembly is a collection of types and resources that are built to work together 
and form a logical unit of functionality. 
An assembly provides the common language runtime with the information it 
needs to be aware of type implementations. 
Assemblies can be static or dynamic. 
Static assemblies can include .NET Framework types (interfaces and classes), as 
well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). 
Static assemblies are stored on disk in portable executable (PE) files. 
Dynamic assemblies are run directly from memory and are not saved to disk 
before execution. Dynamic assemblies are stored on the disk after they have 
executed.
117 
ASSEMBLY Architecture 
In general, a static assembly can consist of four elements: 
 The assembly manifest, which contains assembly metadata. 
 Type metadata. 
 Microsoft intermediate language (MSIL) code that implements the types. 
 A set of resources. 
Assembly Metadata 
Metadata 
MSIL 
Resources 
An assembly manifest contains all the metadata needed to specify the 
assembly's version requirements and security identity, and all metadata 
needed to define the scope of the assembly and resolve references to resources 
and classes. 
 The assembly manifest can be stored in either a PE file (an .exe or .dll) with 
Microsoft intermediate language (MSIL) code or in a standalone PE file that 
contains only assembly manifest information.
118 
MANIFEST FUNCTIONS: 
Assembly Metadata is stored in Manifest contains all the Metadata needed to do 
the following things 
• Version of assembly 
• Security identity 
• Scope of the assembly 
• Resolve References to resources and classes 
ASSEMBLY BENEFITS 
Enable developers to specify version rules between different software components. 
 
Provide the infrastructure to enforce versioning rules. 
Provide the infrastructure to allow multiple versions of a component to be run 
simultaneously (called side-by-side execution). 
NAMESPACE: 
System.Reflection Namespace 
System.Reflection namespace contains classes and interfaces that provide a 
managed view of loaded types, methods, and fields, with the ability to dynamically 
create and invoke types.
119 
SINGLE-FILE ASSEMBLY 
Group all elements in a single physical file 
Assembly Manifest 
Type Metadata 
MULTIFILE ASSEMBLY 
MSIL code 
Resources 
Assembly 
Metadata 
Type 
Metadata 
MSIL code 
Type 
Metadata 
MSIL code 
MSIL code 
The elements of an assembly can be contained in several files. These files can be 
modules of compiled code, resources (such as .bmp or .jpg files), or other files 
required by the application.
120 
ASSEMBLY TYPES 
There are Two types 
 Private Assembly 
 Public Assembly 
PRIVATE ASSEMBLY: 
•A Private assembly is normally used by single application, and is stored in the 
application’s directory or a sub directory 
PUBLIC ASSEMBLY: 
•A shared assembly is normally stored in the global assembly cache, which is a 
repository of assemblies maintained by the .NET runtime. 
•Shared assemblies are usually libraries of code 
Ex: Crystal report classes – used by all application for Reports
121 
GLOBAL ASSEMBLY CACHE 
•GAC is used where shared .NET assembly reside. 
•GAC is used in the following situations 
•If the application has to be shared among several application 
•If the assembly has some special security requirements like only administrators can 
remove the assembly. 
•If the assembly is private then a simple delete of assembly the assembly file will 
remove the assembly 
ADD AND REMOVE AN ASSEMBLY FROM GAC 
gacutil [options] [assemblyName | assemblyPath | assemblyListFile] 
assemblyName 
The name of an assembly. You can supply either a partially specified assembly name 
such as myAssembly or a fully specified assembly name such as myAssembly, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0038abc9deabfle5.
122 
assemblyPath 
The name of a file that contains an assembly manifest. 
assemblyListFile 
•The path to an ANSI text file that lists assemblies to install or uninstall. 
•To use a text file to install assemblies, specify the path to each assembly on a 
separate line in the file. The tool interprets relative paths, relative to the 
location of the assemblyListFile. 
•To use a text file to uninstall assemblies, specify the fully qualified assembly 
name for each assembly on a separate line in the file. 
Examples 
The following command installs the assembly mydll.dll into the global assembly 
cache. 
gacutil /i mydll.dll 
The following command removes the assembly hello from the global assembly 
cache as long as no reference counts exist for the assembly. 
gacutil /u hello 
For example, if both version 1.0.0.0 and 3.2.2.1 of hello are installed in the 
cache, the command gacutil /u hello removes both of the assemblies.
Use the following example to avoid removing more than one assembly. This 
command removes only the hello assembly that matches the fully specified 
version number, culture, and public key. 
gacutil /u hello, Version=1.0.0.1, 
Culture="de",PublicKeyToken=45e343aae32233ca 
123 
Strong-Name Assemblies 
•Strong name is similar to GUID (It is supposed to be unique in space and 
time) in COM components. 
•Strong name is only needed when we need to deploy assembly in GAC. 
•Strong names helps GAC to differentiate between two versions. 
Sn.exe –k “C:test.snk”
124 
ASSEMBLY LOCATION 
An assembly's location determines whether the common language runtime can 
locate it when referenced, and can also determine whether the assembly can be 
shared with other assemblies. You can deploy an assembly in the following 
locations: 
The application's directory or subdirectories. 
• This is the most common location for deploying an assembly. 
• The subdirectories of an application's root directory can be based on language 
or culture. 
• If an assembly has information in the culture attribute, it must be in a 
subdirectory under the application directory with that culture's name. 
The global assembly cache. 
• This is a machine-wide code cache that is installed wherever the common 
language runtime is installed. 
• In most cases, if you intend to share an assembly with multiple applications, 
you should deploy it into the global assembly cache. 
On an FTTP server. 
• An assembly deployed on an FTTP server must have a strong name; you point 
to the assembly in the code base section of the application's configuration file.
125
126 
Contents 
1. Caching Introduction and its Types 
2. Output caching 
3. Fragment Caching 
4. Data Caching 
4.1 Cache APIs 
4.2 Adding Items to cache 
4.3 Cache.Add Method 
4.4 Parameters 
5. Additional Caching Features 
5. Caching Features in .Net 1.1
127 
CACHING 
DEFINITION 
Caching involves temporarily storing the frequently used data for the 
Web application on local hard disks for later retrieval. As a result, the web 
server on which the application resides processes requests for the Website only 
once and caches the requests for future. Any subsequent requests are 
processed from the cache instead of the Webserver.The data can be cached 
either at the client side or at the server side. 
• Client 
The data is stored in temporary files on the hard disk or in memory of the 
clients computer. 
• Server 
Microsoft Proxy Servers are generally used for caching. 
ASP.NET has a powerful, easy-to-use caching mechanism that allows you to 
store objects that require a large amount of server resources to create in 
memory. It is implemented by the cache class. 
• The Cache class has been designed for ease of use. By using keys paired 
with values, you can place items in the Cache and later retrieve them. 
• when system memory becomes scarce, the cache automatically removes 
seldom used or unimportant items to allow memory to be used to process 
a high volume of requests. This technique is called scavenging.
128 
1.OUTPUT CACHING 
Output caching allows you to store the results that a dynamic page 
generates. On subsequent requests, the cached output is used to satisfy the 
request rather than dynamically executing the page code. Output caching is 
also referred to as page caching. 
The following sample illustrates how to cache the output of the page for 30 
seconds: 
Visual C# .NET Sample 
<%@ Page Language="C#" %> 
<%@ OutputCache Duration="30" VaryByParam="*" %> 
To use the @ OutputCache directive to control page output caching, you simply 
add the directive to the top of the page. The Page.InitOutputCache method 
translates the directive into HttpCachePolicy class methods. 
The @ OutputCache directive includes the following attributes and settings: 
Duration: 
This attribute specifies how long an item is held in the cache. The value for 
Duration is listed in seconds. 
VaryByParam: 
This attribute determines cache entries by Get or Post parameters. 
For example, if a QueryString variable named testVal is set for the VaryByParam 
attribute, every page request that contains a different value for testVal is cached 
in a separate page.
Output caching 
@ OutputCache directive contains a Location attribute. 
This attribute determines the location for cached item. You can specify the 
following locations: 
Any 
This stores the output cache in the client's browser, on the proxy server (or any 
other server) that participates in the request, or on the server where the request 
is processed. By default, Any is selected. 
Client 
•This stores output cache in the client's browser. 
Downstream 
•This stores the output cache in any cache-capable devices (other than the origin 
server) that participate in the request. 
Server 
•This stores the output cache on the Web server. 
None 
• This turns off the output cache. 
129 
Visual C# .NET Sample 
<%@ Page Language="C#" %> 
<%@ OutputCache Duration="30" VaryByParam="*" %>
130 
2.FRAGMENT CACHING 
Fragment caching is useful when you need to cache only a subset of 
a page. This is accomplished by caching the outputs of a user control. 
Navigation bars, headers, and footers are good candidates for fragment 
caching. 
• The fragment caching is implemented through User Controls. 
• The fragments of the page that will be cached are placed in one or more User 
Controls. 
•The User Controls are then included in different pages as desired. 
• The caching options for the controls are specified by placing an 
OutputCache directive within each control or programmatically in the code 
behind using the PartialPageCachingAttribute. 
•The caching parameters are set on the individual controls rather than within 
the page itself. 
•The User Controls are then cached independently according to each 
directive, while the remainder of the page content remains dynamic and 
uncached.
131 
3. DATA CACHING 
 Data caching is where the majority of the control is handled 
programmatically. 
 The Cache class located in the System.Web.Caching namespace is the way in 
which items are added into and retrieved from the ASP.NET cache. 
 It is relatively straightforward to use in your Web applications. 
 The Cache class provides a dictionary type interface, which means you assign 
a key to the value when it is stored. 
 The key is used to access the value again at a future point in time when it is 
needed. 
1.Using a name value pair similar to a Dictionary object. 
Example: Cache[“keyName”] = “MyValue”; 
Example: Cache[“keyName2”] = myObject;
DATA CACHING Example 
2.Using the Cache.Add method, which returns an object representing the 
item added into the cache. If an object with the given key name already 
exists in the cache, then the Add method will fail. 
132 
Example: Cache.Add(“keyName”, “MyValue”); 
Example: Cache.Add(“keyName2”, myObject); 
3. Using the Cache.Insert method, which, unlike the Insert method, does not 
have a return type. In addition, if an item already exists in the cache with 
the given key name, the Insert method will override it with the new value 
given. 
Example: Cache.Insert(“keyName”, “MyValue”); 
Example: Cache.Insert(“keyName2”, myObject);
133 
CACHE APIS 
Cache Application Programming Interfaces (APIs) allow you to programmatically 
store arbitrary objects to memory so that your application can save the time and 
resources that it takes to re-create them. 
Cache APIs allow you to expire items from the cache based on the following 
credentials: 
•Time 
•File dependencies 
•Cache key dependencies 
The Cache class has been designed for ease of use. By using keys paired with 
values, you can place items in the Cache and later retrieve them. 
You can instruct the Cache to give certain items priority over other items when 
it performs scavenging. To indicate that a specific item is of greater or lesser 
importance than another, specify one of the CacheItemPriority enumeration values 
when you add an item using the Cache.Add method or Cache.Insert method.
134 
ADDING ITEMS TO THE CACHE 
There are three different techniques you can use to add an item to the Cache object. 
If you want to take advantage of the scavenging, expiration, and dependency support 
offered by the Cache, you must use either the Cache.Insert method or the Cache.Add 
method. 
Cache.Insert Method (String, Object) 
Inserts an item into the Cache object with a cache key to reference its 
location and using default values provided by the CacheItemPriority enumeration 
[C#] 
publicvoid Insert( string key, object value ); 
PARAMETERS 
key 
The cache key used to reference the item. 
value 
The object to be inserted into the cache. 
The following example demonstrates how to insert an item into an application's 
cache. 
[C#] 
Cache.Insert("DSN", connectionString);
135 
PARAMETERS 
key 
The cache key used to reference the item. 
value 
The item to be added to the cache. dependencies 
The file or cache key dependencies for the item. When any dependency changes, the 
object becomes invalid and is removed from the cache. If there are no dependencies, 
this paramter contains a null reference. 
absoluteExpiration 
The time at which the added object expires and is removed from the cache. 
slidingExpiration 
The interval between the time the added object was last accessed and when that object 
expires. If this value is the equivalent of 20 minutes, the object expires and is removed 
from the cache 20 minutes after it is last accessed. 
priority 
The relative cost of the object, as expressed by the CacheItemPriority enumeration. 
The cache uses this value when it evicts objects; objects with a lower cost are removed 
from the cache before objects with a higher cost. 
onRemoveCallback 
A delegate that, if provided, is called when an object is removed from the cache. You 
can use this to notify applications when their objects are deleted from the cache.
CACHING FUNDAMENTALS IN ASP.NET FRAMEWORK 1.1 
Cache 
• A static object with a collection dedicated to storing and processing cache 
information (System.Web.Caching.Cache). 
Cache Dependency 
• It is a mechanism through which the cache data can be made dependant on any file or 
a key data present in the cache itself. 
Cache Expiration 
• It provides a way to provide expiration to the data available in the cache. 
Cache Callback 
•: It is a delegate, which can be associated with any cache item. It is invoked when the 
associated item in the cache expires due to any reason. 
The expiration reasons can be any of the following 
1. Removed: The item is explicitly removed from cache. 
2. Expired: The item’s time is expired due to cache time out or its own 
136 
expiration policy settings. 
3. Underused: The cache item is removed from the cache due to shortage of 
resources. 
4. Dependency Changed: The cache item is removed from the cache because 
its dependency has been changed.
137
138 
Contents 
1.Authentication 
1.1 Authentication Options 
1.2 Form Authentication 
1.3 Demo 
2.Authorization
139 
AUTHENTICATION 
THIS IS WHO I AM 
Authentication is the process of deciding who can access the application. 
User name and Password is the most common mechanism for 
Authentication. 
Authentication means validating a user based on set of credentials 
Authorization occurs after authentication. 
Ex: 
such as E-mail, username, and password. 
Authorization requires specifying access restrictions and permissions for 
your users. Hence,these terms are different but interrelated.
Authentication Accepted Authentication Rejected 
Display Content Redirect To Registration 
As you see in the above diagrams,when a user enters the 
140 
application,two possible courses of action occur. 
1.The user is authenticated,so the requested content is returned. 
2.The user is not authenticated and is sent to a registration 
form.Once the registration process is successful,then and only then is the 
requested content returned.
141 
Options Available 
 Forms Authentication : 
Login request are made by filling form in a web page and 
submitting that form to the server. 
 Windows Authentication : 
Login pages pass user credentials to a web server.The web server 
then handles the authentication using which ever method is 
configured on the virtual directory that the application is 
running within. 
 Passport Authentication : 
Authentication is performed via a centralized authentication 
provided by Microsoft.
FORMS AUTHENTICATION MODEL 
BROWSER SERVER 
Browser request page B and passes a copy of the cookie 
142 
Browser sends request for page A to the server 
Server refuses anonymous access and sends login page 
instead 
Browser sends a login request to the server 
BROWSER SERVER 
Server authenticates and returns page A along with a 
cookie to the browser 
BROWSER SERVER 
Server accepts cookie and sends back page B
 Forms authentication handles authentication using your own 
custom logic with an ASP.NET application. 
 When a user requests a page for the application, ASP.NET checks 
for the presence of a special session cookie.If the cookie is 
present,ASP.NET assumes the user is authenticated and process the 
request. 
 If the cookie isn’t present,ASP.NET redirects the user to a 
Webform you provide. 
143 
Forms Authentication 
Using a Web.Config file 
<configuration> 
<system.web> 
<authentication mode="Forms"> 
<forms name="logincookies" 
loginUrl="login.aspx” 
protection="All" 
timeout="30“ 
path="/" /> 
</authentication> 
<authorization> 
<deny users="?" /> 
</authorization> 
</system.web> 
</configuration> 
Attributes Description 
•Name Name of the authentication cookie 
•LoginUrl The login page to which 
unauthenticated 
users should be redirected. 
•Protection Protect the authentication cookie 
•Timeout The timeout value for the cookie 
to expire.
Checking the username and password through Authentication 
Enter the Username 
And Password in 
Textbox 
144
The username is not 
valid then it display 
the error message 
145
146
147 
AUTHORIZATION 
what I can do: 
When user name and password matches it checks to see what 
permission you have been granted. 
DEFINITION 
The process of granting a user the permission to use a resource, or 
denying them access to a resource or a group of resources. 
Coding 
<authorization> 
<deny users="?" /> 
</authorization>
148 
Tag Description 
Deny This can take three attributes. 
1. User: User name can be particular user 
name or ? Anonymous users. 
2.Role: Describes particular role such as 
administrator. 
3.Verb: set to a particular request. 
Allow This can take three attributes 
1. User: User name can be particular user 
name or ? Anonymous users. 
2.Role: Describes particular role 
such as administrator. 
3.Verb: set to a particular request.
149
150 
Debugging ASP.NET 
• Using Visual Studio .NET debugging tools 
– Breakpoints 
– Stop keyword 
– System.Diagnostics.Debug 
– Command/Immediate Windows 
– Add Watch/Quick Watch 
– Autos/Locals Windows 
• Trace 
• Client Script Debugging 
– Active Documents 
– Debugger keyword
151
152 
Contents 
1.Intro to Tracing 
2.Page Level Tracing 
2.1 Write Trace Contents 
3.Application Level Tracing 
3.1 Viewing Trace
153 
Tracing 
 ASP.NET introduces new functionality that allows you to view diagnostic 
information about a single request for an ASP.NET page simply by enabling it for 
your page or application. 
 In order for these messages and other tracing information to be gathered and 
displayed, we must enable tracing for the page or application. 
 Trace statements are processed and displayed only when tracing is enabled. 
You can control whether tracing is displayed to a page, to the trace viewer, or 
both. 
Types: 
1.Page-Level Tracing 
2.Application-Level Tracing
154 
Page Tracing 
Page-Level Tracing 
We can control whether tracing is enabled or disabled for a page with the 
Trace attribute of the @ Page directive. Regardless of whether the write messages 
to the trace log, when you enable tracing and the page is requested, ASP.NET 
appends a series of tables containing performance information about the page 
request. 
Tracing is disabled by default. If you do not include a Trace attribute in your page, 
trace information is not gathered, and trace statements you write do not appear 
on the page. 
To enable tracing for a page 
Include an @ Page directive at the beginning of your .aspx file. Include the Trace 
attribute, and set its value to true. 
<%@ Page Trace="true" %> 
Security Note When tracing is enabled for a page, trace information is displayed 
on any browser that makes a request for the page from the server. Tracing 
displays sensitive information, such as the values of server variables, and can 
therefore represent a security threat. 
<%@ Page Language=“C#" Trace="True" 
TraceMode="SortByCategory" %>
155 
Output For Page Info 
The information of 
page should be 
shown here
156 
Writing Trace Messages 
ASP.NET uses the Trace Context class to store information about a request, its 
control hierarchy, and trace information. The TraceContext class is available to 
Web Forms pages through the Page Trace property. 
Current property to access the TraceContext class. In this case, use 
HttpContext.Current.Trace syntax. 
The TraceContext class provides two methods, Write and Warn, which allow 
you to write statements to the trace log. Each method is overloaded and 
allows you to specify a tracing category, a text message, and optional error 
information. The only difference between these methods is that the Warn 
method displays its text in red. 
The first is treated as a category, which you can use to sort where your 
messages appear in the Trace Information table that is displayed when 
tracing is enabled. 
The Second argument is of type Exception and contains error information 
for the request, if there is any.
Page Trace Output with Warn And Write Methods 
Warn( ) 
Messages 
Write() Messages 
157
158 
Application-Level Tracing 
To enable tracing for an application 
1. If you have not done so already, create a text file, name it Web.config, and 
save it to your application's root directory. 
2. Between the opening and closing tags of the <configuration> element, add 
the opening and closing tags of a <system.web> element. 
3. Between the <system.web> element tags, add a <trace> element, which is 
self-closing. 
4. In the <trace> element, declare the enabled attribute and set it to true. 
5. Declare other optional attributes to modify your application's trace 
behavior, as you want. For example, the following application trace 
configuration collects trace information for up to 40 requests and allows 
browsers on computers other than the origin server to display the trace viewer. 
<configuration> 
<system.web> 
<trace enabled="true" requestLimit="40" localOnly="false"/> 
</system.web> 
</configuration>
Viewing Trace Information with the Trace Viewer 
• To view these statements and the additional trace information in the trace 
viewer by requesting Trace.axd from the root of your application directory. 
•To enable set the pageOutput attribute to true in the Web.config file. 
Traced 
Application 
Information 
159
160
161 
Contents 
1. Introduction About Web Services 
2. Usage Of Web Services 
3. SOAP 
4. WSDL And UDDI 
5. Internet Towards Web services 
6. Demo with illustration
162 
Web Services 
What are Web Services? 
• Web services are application components 
• Web services communicate using open protocols 
• Web services are self-contained and self-describing 
• Web services can be discovered using UDDI 
• Web services can be used by other applications 
• XML is the basis for Web services 
The basic Web services platform is XML + HTTP. 
• The HTTP protocol is the most used Internet protocol. 
• XML provides a language which can be used between different platforms and 
programming languages and still express complex messages and functions. 
Web services platform elements 
• SOAP (Simple Object Access Protocol) 
• UDDI (Universal Description, Discovery and Integration) 
• WSDL (Web Services Description Language)
163 
Web services and its uses 
Reusable application components 
There are things different applications needs very often. 
 Web services can offer application components like currency 
conversion, weather reports or even language translation as services. 
 Ideally, there will only be one type of each application component, and 
anyone can use it in their application. 
Connect existing software 
Web services help solve the interoperability problem by giving different 
applications a way to link their data. 
Using Web services you can exchange data between different applications 
and different platforms. 
Web Services have three basic platform elements 
These are called SOAP, WSDL and UDDI.
164 
What is SOAP? 
The basic Web services platform is XML plus HTTP. 
•SOAP stands for Simple Object Access Protocol 
•SOAP is a communication protocol 
•SOAP is for communication between applications 
•SOAP is a format for sending messages 
•SOAP is designed to communicate via Internet 
•SOAP is platform independent 
•SOAP is language independent 
•SOAP is based on XML 
•SOAP is simple and extensible 
•SOAP allows you to get around firewalls 
•SOAP will be developed as a W3C standard
165 
WDSL And UDDI 
WSDL 
WSDL is an XML-based language for describing Web services and 
how to access them. 
•WSDL stands for Web Services Description Language 
•WSDL is written in XML 
•WSDL is an XML document 
•WSDL is used to describe Web services 
•WSDL is also used to locate Web services 
•WSDL is not yet a W3C standard 
What is UDDI? 
UDDI is a directory service where businesses can register and 
search for Web services. 
•UDDI stands for Universal Description, Discovery and Integration 
•UDDI is a directory for storing information about web services 
•UDDI is a directory of web service interfaces described by WSDL 
•UDDI communicates via SOAP 
•UDDI is built into the Microsoft .NET platform
Heading towards a new model for the Internet 
WWeebb 
SSeerrvviiccee 
166 
XXMMLL 
““BBuuiillddiinngg BBlloocckk 
SSeerrvviicceess”” 
WWeebb 
SSeerrvviiccee 
HTML 
CClliieenntt 
DDeevviiccee 
XML 
CClliieenntt 
DDeevviiccee 
XXMMLL 
WWeebb 
SSeerrvviiccee 
XML 
WWeebb 
SSeerrvviiccee 
XXMMLL 
XXMMLL
167 
Web Services 
PPuurrcchhaassee ccoouurrsseewwaarree 
PPuurrcchhaasseedd 
DDeessiiggnneedd ffoorr ppeeooppllee ttoo bbrroowwssee
168 
Web Services 
PPuurrcchhaassee CCoouurrsseewwaarree ? 
Server ttoo sseerrvveerr iiss aa pprroobblleemm
169 
Web Services 
PPuurrcchhaassee CCoouurrsseewwaarree ? 
Server ttoo sseerrvveerr iiss aa pprroobblleemm
170 
Web Services 
• Allow applications to communicate across the Internet 
• Platform independent 
• Protocol independent 
• Synchronous/asynchronous 
• Stateful/stateless 
• BizTalk® 
• ASP.NET
171 
Web Services 
..AA..AASSSSMMMMXXXX 
Class Courseware 
Class Courseware 
WebMethod 
WebMethod 
GetPrice 
Purchase 
GetPrice 
Purchase
172 
Web Services 
..A.AASSSSMMMMXXXX 
TTeessttiinngg 
CCoouurrsseewwaarree..aassmmxx 
TTeesstt HHTTMMLL PPaaggee
173 
Web Services 
..AA..AASSSSMMMMXXXX 
CCoouurrsseewwaarree..aassmmxx??WWSSDDLL 
SSeerrvviiccee DDeeffiinniittiioonn((XXMMLL)) 
PPrrooxxyy 
DDLLLL 
PPrrooxxyy 
DDLLLL 
WWSSDDLL
RReeggiisstteerr ffoorr CCoouurrssee PPuurrcchhaassee CCoouurrsseewwaarree 
174 
Web Services 
PPrrooxxyy 
DDLLLL 
PPrrooxxyy ..A.AASSSSMMMMXXXX 
DDLLLL
175
176 
Contents 
1. Ajax Introduction 
2. Ajax Transaction 
3. Http Request in Ajax 
4. Non-Ajax 
5. Ajax Enabled 
6. Using Ajax 
7. Demo
AJAX 
● Asynchronous – Communication can take place with the server 
as the user is interacting with the page. 
● JavaScript – Coding is done in JavaScript which is close to cross 
browser compatible 
177 
● And 
● XML – The original design was for data to be passed back and 
forth using XML (i.e. Web Services). As we will see, there are now 
other methods of passing data as well.
 AJAX is not a new programming language, but a technique for creating 
better, faster, and more interactive web applications. 
 With AJAX, your JavaScript can communicate directly with the server, 
using the JavaScript XMLHttpRequest object. With this object, your JavaScript 
can trade data with a web server, without reloading the page 
 AJAX uses asynchronous data transfer (HTTP requests) between the 
browser and the web server, allowing web pages to request small bits of 
information from the server instead of whole pages. 
 With an HTTP request, a web page can make a request to, and get a 
response from a web server - without reloading the page. The user will stay on 
the same page, and he or she will not notice that scripts request pages, or send 
data to a server in the background. 
 AJAX is a browser technology independent of web server software. 
178 
AJAX Transaction
179 
Requests usage in AJAX 
The XMLHttpRequest Object 
By using the XMLHttpRequest object, a web developer can update a page 
with data from the server after the page has loaded! 
AJAX was made popular in 2005 by Google (with Google Suggest). 
Google Suggest is using the XMLHttpRequest object to create a very 
dynamic web interface: When you start typing in Google's search box, a 
JavaScript sends the letters off to a server and the server returns a list of 
suggestions. 
The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 
1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7.
Web Browser 
Web Server 
www.mypage.com 
180 
User http://www.myPage.com/ 
Page GET / 
Non-Ajax
181 
Non-Ajax 
Web Browser 
(Default.aspx) 
User views new page 
Web Server 
User Some Interaction 
www.mypage.com 
POST Form Variables 
Refresh entire page
182 
Ajax Enabled 
1st part same as before 
Web Browser 
Web Server 
www.mypage.com 
User 
http://www.myPage.com/ 
GET / 
Page
183 
Ajax Enabled 
Here is the different 
Web Browser 
(Default.aspx) 
Javascript updates DOM 
Web Server 
www.mypage.com 
User 
Some Interaction 
Asynchronous Data Chunk HTTP Callback
184 
Using AJAX 
Add reference ajax.dll to your project 
Modify your web.config to configure IHttpHandler for Ajax.NET 
requests 
Write your methods in C#/VB.NET and add the attribute 
[AjaxMethod] 
Call Class1.Method1(param1, param2, callback, context); from 
client-side JavaScript
Using AJAX 
Methods only get attribute, no need to implement 
185 
interface or inherit from class 
[AjaxMethod] 
public int GetAge(string username){…} 
Source-code doesn‘t change if you want to use the method 
in server-side code 
DemoMethods dm = new DemoMethods(); 
int age = dm.GetAge(“michael“); 
WebServices can be used without code change: 
<script type= “text/javascript“ src=“servie1.asmx?AJAX“></script>
186 
Open The Web Application 
In Solution Explorer choose 
the add reference
In The Add Reference box 
choose the AJAX dll 
187
Browse the path where 
the Ajax.dll located 
188
Add the dll to our 
application 
189
Here the reference 
should added 
190
191
192 
Demo : Add two values using AJAX
193
194
195 
The values Added using 
AJAX
196 
Wow…
197

More Related Content

What's hot

Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net frameworkAshish Verma
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)citizenmatt
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
 
.NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits .NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits Deepika Chaudhary
 
dot net technology
dot net technologydot net technology
dot net technologyImran Khan
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Mohamed Saleh
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET FrameworkANURAG SINGH
 
Evolution of .net frame work
Evolution of .net frame workEvolution of .net frame work
Evolution of .net frame workvc7722
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clrSanSan149
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Jeff Blankenburg
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet frameworkNitu Pandey
 
.net CLR
.net CLR.net CLR
.net CLRDevTalk
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...yazad dumasia
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netsuraj pandey
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .netFelisha Hosein
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net FundamentalsLiquidHub
 

What's hot (20)

Microsoft dot net framework
Microsoft dot net frameworkMicrosoft dot net framework
Microsoft dot net framework
 
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
.NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits .NET Framework 4.0 – Changes & Benefits
.NET Framework 4.0 – Changes & Benefits
 
dot net technology
dot net technologydot net technology
dot net technology
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET Framework
 
Evolution of .net frame work
Evolution of .net frame workEvolution of .net frame work
Evolution of .net frame work
 
Common language runtime clr
Common language runtime clrCommon language runtime clr
Common language runtime clr
 
.Net framework
.Net framework.Net framework
.Net framework
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
.net CLR
.net CLR.net CLR
.net CLR
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Microsoft.Net
Microsoft.NetMicrosoft.Net
Microsoft.Net
 
01 intro to programming in .net
01   intro to programming in .net01   intro to programming in .net
01 intro to programming in .net
 
Introduction to .NET Framework
Introduction to .NET FrameworkIntroduction to .NET Framework
Introduction to .NET Framework
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 

Similar to Asp.net new

Unit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUnit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUjwala Junghare
 
Net framework
Net frameworkNet framework
Net frameworkjhsri
 
ASP.Net Technologies Part-1
ASP.Net Technologies Part-1ASP.Net Technologies Part-1
ASP.Net Technologies Part-1Vasudev Sharma
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra SolutionsQUONTRASOLUTIONS
 
1-.NET Introduction.pptx
1-.NET Introduction.pptx1-.NET Introduction.pptx
1-.NET Introduction.pptxRKAggarwal6
 
.Net framework
.Net framework.Net framework
.Net frameworkRaghu nath
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 
Cetpa infotech is the best advanced .net training institute in Delhi NCR
Cetpa infotech is the best advanced .net training institute in Delhi NCRCetpa infotech is the best advanced .net training institute in Delhi NCR
Cetpa infotech is the best advanced .net training institute in Delhi NCRACCHITABAJPAI
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworksnawal saad
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)Shoaib Ghachi
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iRakesh Joshi
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iRakesh Joshi
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET rchakra
 

Similar to Asp.net new (20)

Unit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUnit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdf
 
Net framework
Net frameworkNet framework
Net framework
 
ASP.Net Technologies Part-1
ASP.Net Technologies Part-1ASP.Net Technologies Part-1
ASP.Net Technologies Part-1
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
Session i
Session iSession i
Session i
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions
 
Programming
Programming Programming
Programming
 
1-.NET Introduction.pptx
1-.NET Introduction.pptx1-.NET Introduction.pptx
1-.NET Introduction.pptx
 
.Net framework
.Net framework.Net framework
.Net framework
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
Cetpa infotech is the best advanced .net training institute in Delhi NCR
Cetpa infotech is the best advanced .net training institute in Delhi NCRCetpa infotech is the best advanced .net training institute in Delhi NCR
Cetpa infotech is the best advanced .net training institute in Delhi NCR
 
Introduction of .net framework
Introduction of .net frameworkIntroduction of .net framework
Introduction of .net framework
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
VB IMPORTANT QUESTION
VB IMPORTANT QUESTIONVB IMPORTANT QUESTION
VB IMPORTANT QUESTION
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
Dot net Introduction and their usabilities
Dot net Introduction and  their usabilitiesDot net Introduction and  their usabilities
Dot net Introduction and their usabilities
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dotnet1
Dotnet1Dotnet1
Dotnet1
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
 

Recently uploaded

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Asp.net new

  • 1. 1
  • 2. 2 Index 1. .Net Introduction 2. Asp.Net Introduction 3. Controls 4. State Management 5. Asp.Net Objects 6. Asp.Net Web Application 7. Assembly 8. Caching 9. Security 9. Debugging 10. Tracing 11. Web Services 12. AJAX
  • 3. 3
  • 4. 4 Contents 1. .Net Introduction 2. The Origins of .Net Technology 3. The .Net Framework 4. .Net Languages 5. Benefits Of The .Net Approach
  • 5. 5 .Net Introduction Definition: .Net is a software framework that includes everything required for developing software for web services  It integrates presentation technologies,component technologies and data technologies on a single platform.  Microsoft took many of the best ideas in the industry,added their own creativity and innovations and produced a coherent systems solution popularly known as Microsoft .NET Microsoft .Net Platform Includes 1. .NET infrastructure and Tools 2. .Net user experience 3. .Net building block 4. .Net device Software
  • 6. The Origins Of .Net Technology The current technology of .Net has gone through three significant phases of 6 development : 1. OLE Technology 2. COM Technology 3. .NET Technology OLE Technology:  To embed documents from one applications into another application.  To enable one application to manipulate objects located in another application Ex:MS Word and MS Excel COM Technology  Reduces the overall complexity of software  Enables distributed development across multiple organizations or departments  Enhances Software Maintainability .NET Technology  Third-Generation Component Model  It Provides a new level of inter-operability compared to COM technology.  It Uses Intermediate language(MSIL)for compilation.
  • 7. 7 .Net Framework The .Net framework is one of the tools provided by the .NET infrastructures and tools component of the .NET platform. .Net platform provides a new environment for creating and running robust,scalable and distributed applications over the web. Definitions The .NET framework provides an environment for building,deploying and running web services and other applications. The Main components are •Common Language Runtime(CLR) •Framework Base Classes •User and program interfaces. Click Here to Enlarge
  • 8. Common Language Runtime(CLR) 8 The CLR is the core of the.NET framework and is responsible for loading and running C# programs •The common Language Runtime,popularly known as CLR is the heart and soul of the .NET framework. •It is runtime environment in which programs written c# and other .NET languages are executed. •It also supports Cross-Language Interoperability The CLR provides a number of services that include Loading and execution of programs Memory isolation for applications Verification of type safety Compilation of IL into native executable code Providing metadata Memory Management Enforcement of security Interoperability with other systems Managing exceptions and errors Support for tasks such as debugging and profiling Click Here To Enlarge
  • 9. 9 CLR Components Common Type System(CTS) The .Net frame work provides multiple language support using the feature known as Common Type System that is built into the CLR.The CTS supports a variety of types and operations found in most programming languages and therefore calling one language from another language does not require type conversions. Common Language Specification The common Language specification defines a set of rules that enables interoperability on the .NET Platform.These rules serve as a guide to third-party compiler designers and library builders.The CLS is a subset of CTS and therefore the languages supporting the CLS can use other’s class libraries as if their own.Application Program Interface(APIs) that are designed following the rules of CLS can easily be used by all the .NET Languages. Microsoft Intermediate Language(MSIL) MSIL,or simply IL,is an instruction set into which all the .NET programs are compiled.It is akin to assembly language and contains instructions for loading,storing,initializing and calling methods.When we compile a C# program or any program written in CLS-Compliant language,the source code is compiled into MSIL Managed Code As we know,the CLR is responsible for managing the execution of code compiled for the .NET platform.The code that satisfies the CLR at runtime in order to execute is referred to as managed Code.Compilers that are compatible to the .Net platform generate managed code.
  • 10. 10 Framework Base Classes .Net supplies a library of base classes that we can use to implement applications quickly.We can use them by simply instantiating them and invoking their methods or by inheriting them through derived classes,thus extending their functionality. Much of the functionality in the base framework classes resides in the vast namespace called System The system namespaces included Input/Output Operations String Handling Managing arrays,lists,maps,etc Accessing files and file systems Accessing the registry Security Windowing Window messages Database Management Evaluation of mathematical functions Drawing Managing errors and exceptions Connecting to the internet and etc.. Click Here To Enlarge
  • 11. USER AND PROGRAM INTERFACES The .NET framework provides the following tools for managing user-and 11 application interfaces: •Windows Forms •Web Forms •Console Applications •Web Services These tools enable users to develop user-friendly desktop-based as well as web-based applications using a wide variety of languages on .NET platform
  • 12. 12 .NET Languages The .NET framework is language neutral.Currently,we can use a number of languages for developing .NET applications.They include: Native to .NET • C#(Specially created for .NET) • C++ • Visual Basic • Jscript Third Party Languages •COBOL •Eiffel •Perl •Python •SmallTalk •Mercury •Scheme All .NET languages are not created equal.Some Can use the components of the other languages,some can use the classes produced in other languages to create objects,and some languages can extend the classes of other languages using the inheritance features in .NET
  • 13. Benefits Of The .NET Approach  Simple and faster systems development  Rich object model  Enhanced built-in functionality  Many different ways to communicate with the outside world  Integration of different languages into one platform  Easy deployment and execution  Wide range of scalability  Interoperability with existing applications  Simple and easy-to-build sophisticated development tool  Fewer bugs  Potentially better performance 13
  • 14. 14
  • 15. 15 Contents 1.Classic ASP 1.1 Classic ASP Success/Demerits 1.2 A New Asp.Net Era 2.System Architecture 2.1 Application Architecture overview 2.2 Building a 3-Tier Architecture 2.3 Asp.Net Web Application Architecture 3.Asp.net features 4.Asp.Net Web Pages 4.1 Asp.Net Web Form 4.2 Event Flow 4.3 Asp.Net code Changes 5.Asp.Net Execution 5.1 Asp.Net Execution Model 5.2 Compilation and Execution 5.3 Multimedia Execution
  • 16. “Classic” ASP Demerits 16 “Classic” ASP Successes • Simple procedural programming model • Access to COM Objects – ADO – File system object • No compiling, just save • Support for multiple scripting languages • Mix HTML and code • VBscript – leverage Visual Basic skills •Tied tightly into IIS •Not Really Cross-platform –Solutions exists for Apache & Linux •Not easy to implement •Can only use Visual Basic or Java •Script Language – must be interpreted
  • 17. 17 “Classic” ASP Challenges • Code readability • Coding overhead • Post Back complexity • Reuse • Performance • DLL locking • Deployment • Sessions • Caching
  • 18. SSyysstteemm AArrcchhiitteeccttuurree?? 18 A New Era – ASP.NET • A complete rewrite of the original ASP – Kept the best concepts from ASP • your code from the HTML – Separates the programming logic from the look of the page – Program in ANY .NET language – Better tools, debugging • Pre-fabricated controls – Similar to Windows controls • Built-in security mechanisms • session management • Just-in-time compilation – No server restarts required • Settings stored in XML Its mainly based on the 3-Tier System Architecture
  • 19. 19 System Architecture Single tier Architecture Presentation,Business logic and data logic all are present in the same layer,which normally runs on a stand-alone system.e.g., C,C++ applications. Two tier Architecture Presentation and business logic will be present in one layer and data logic will be available in a separate layer.Example: Client-Server application. Three-tier Architecture Presentation,Business logic and data logic all are present in different layers.Asp.Net are developed using 3-tier architecture. N-tier Architecture Presentation,Business logic and data logic all are present in different layers.Business logic may present in multiple layers. Web Applications using external services are developed using n-tier architecture. E.g. Remoting and web services ( Weather forecasting ).
  • 20. Application Architecture overview Presentation 20 Distributed Presentation Business Logic Data Three-Tier Presentation Business Logic Data Business Logic Data Monolithic Presentation Business Logic Data Client/Server Presentation Business Logic Data Click Here To Enlarge
  • 21. 21 Building a 3-Tier Application Presentation Tier This Tier is responsible for communication with the users and web service consumers and it will use objects from Business Layer to response GUI raised events. Logical Tier This is the brain of the 3-Tier Application. Some architects do not make any distinction between Business Tier and Data Access Tier. Some of the advantages are  Increases code transparency  Supports changes in Data Layer. You can change or alter database with out touching the Business Layer and this would be a very minimum touch up. Data Tier This Tier is responsible for retrieving, storing and updating the Information therefore this tier can be ideally represented through a commercial database. We consider stored procedures as a part of the Data Tier. Usage of stored procedures increases the performance and code transparency of an application.
  • 22. ASP.NET Web Application Architecture 22 PPrreesseennttaattiioonn TTiieerr User Controls (.ascx) BBuussiinneessss LLooggiicc TTiieerr DDaattaa TTiieerr Graphic Files UI Pages (.htm) XML Web Services (.asmx) Code-Behind File (.aspx.vb or .aspx.cs) PPrrooxxyy AADDOO..NNEETT .NET Objects Data Source COM+ Services RRCCWW COM Objects Web Form (.aspx)
  • 23. 23 ASP .NET Features ASPX, ASP – side by side Simplified programming model Simplified deployment Better performance Caching Security Powerful controls Simplified browser support Simplified form validation Code behind pages More powerful data access Web services Better session management No DLL locking No DLL registration Simplified configuration Page lets
  • 24. 24 What Is a Web Form? .aspx extension Page attributes @ Page directive Controls save state Body attributes Form attributes <%@ Page Language="C#" Inherits=Project.WebForm1 %> <html> <body ms_positioning="Grid Layout"> <form id="Form1" method="post" runat="server"> </form> </body> </html> Enlarge Enlarge
  • 25. 25 EEvveenntt ffllooww iinn AASSPP..NNEETT ppaaggeess ((..aassppxx)) – Application Level Events (Global.asax) – Page_Init: page and controls are initialized – Page_Load: all the controls and page are loaded – Change events for controls are processed – Click events for controls are processed – Page_PreRender: page is about to render – Page_Unload: page is unloaded from memory The Page Directive Defines page-specific (.aspx file) attributes used by the ASP.NET page parser and compiler. Example showing an .aspx page mapped to its code behind: <%@ Page Codebehind="WebForm1.aspx.vb" inherits="AspNet.WebForm1" %>
  • 26. 26 ASP.NET Coding Changes • Page directives – Language attribute must be in set the @Page directive • Structural changes – All functions and variables must be declared within a <script> block – Only one language per page – Render Functions are no longer supported; use Response.Write • Design-Time controls are no longer supported – Replaced with Web controls
  • 27. 27 VViissuuaall BBaassiicc SSoouurrccee ccooddee CCoommppiilleerr CC## CC++++ CCoommppiilleerr CCoommppiilleerr AAsssseemmbbllyy IILL CCooddee AAsssseemmbbllyy IILL CCooddee AAsssseemmbbllyy IILL CCooddee CCoommmmoonn LLaanngguuaaggee RRuunnttiimmee JJIITT CCoommppiilleerr NNaattiivvee CCooddee OOppeerraattiinngg SSyysstteemm SSeerrvviicceess MMaannaaggeedd ccooddee UUnnmmaannaaggeedd CCoommppoonneenntt ASP.NET Execution Model
  • 28. ASP.NET Runtime Compilation and Execution language Which? 28 default.aspx Native code C# Visual Basic .NET Visual Basic .NET compiler C# compiler MSIL JIT compiler Common Language Runtime HTML
  • 30. 30
  • 31. 31 Contents 1.Introduction to Control 1.1 Web form Vs HTML Controls 1.2 Server Control 1.2 Maintaining the state in Server Control 1.3 How to Open The Application? 2.Toolbox and its control types 2.1 HTML Controls 2.2 Web form Control 2.3 Validation Control 2.3 List Control 2.4 Component 2.5 Data Control
  • 32. An ASP.NET control that helps you to transfer data between a dialog page and its invoker page. 32 Introduction Controls Types • Web Form Controls As Sever controls • Textbox, Label, Hyperlink, Etc • Dropdown List, Data Grid, Data List, Etc • HTML Controls (Client or Server) • ADO.NET Design Controls(Data Controls) • System Components • Validation Controls Properties window Controls
  • 33. 33 Web Form Vs HTML Controls Both have the following benefits – An object model that you can program against on the server – A set of events for which you can write sever side event handlers. – The ability to handle events in client script . – Automatic maintenance of the control's state (View State). – Interaction with validation controls so you can easily verify that a user has entered appropriate information into a control. – Data binding to one or more properties of the control. – Support for HTML 4.0 styles if the Web Forms page is displayed in a browser that supports cascading style sheets. – Pass-through of custom attributes.
  • 34. 34 What is a Server Control? <asp:Button id="Button1" runat="server" Text="Submit"/> • Runat="server" – Event procedures run on the server – View state saved • Properties and methods are available in server-side event procedures private void btn_Click(object sender, System.EventArgs e) { lblName.Text = txtName.Text; } •Without code –Required field –Within range –Two fields equal (password) –Regular expressions –Validation error messages •With code, but simplified –Custom validation
  • 35. Maintaining the State of ASP.NET Server Controls • Server control state is stored in __VIEWSTATE, a hidden control on the Web Form • VIEWSTATE stores state in a string value of name-value pairs 35 <form id="Form1" method="post" runat="server"> <input type="hidden" name="__VIEWSTATE" value="dDw3NzE0MTExODQ7Oz4=" /> 'HTML here </form> On by default, adjustable at Web Form and control level <%@ Page EnableViewState="FFaallssee"" %%>> <asp:ListBox id="ListName" EnableViewState="true" runat="server"> </asp:ListBox>
  • 36. Choose The Application what ever u want create 36 Visual C# Projects—Asp.Net Web Application
  • 37. 37 Open The Web form Task Bar Toolbox Web Form Solution Explorer Properties Window
  • 38. 38 HTML Coding Enlarge
  • 39. 39 Code- Behind Enlarge
  • 40. Toolbox:It Contains Collection of components or controls Using Tools: 1.Just Drag And Drop in the Web form Asp.Net Toolbox: 1.Web Forms-General Server Controls 2.Data Controls:Used For Connectivity 3.HTML Controls-As Like General controls like Textbox and Label etc.. 40 Toolbox
  • 41. 41
  • 42. 42 HTML Controls HTML Controls: •This Control used general what we used before in html. •Here the control is not called as Server Control •While using this HTML Control we should convert as Server Control in our ASP.Net Application HTML Coding <DIV style="DISPLAY: inline; HEIGHT: 15px"ms_positioning="Flow Layout">Label</DIV>
  • 43. Converting HTML Control to Asp.Net Sever Control Control Drag and Drop the html control in web form Select the control Right Click the control and mark as “Run As Server Control” Now the control changed as Server Control HTML Control convert as Server Control <DIV style="DISPLAY: inline; Z-INDEX: 101; HEIGHT: “76px"ms_positioning="Flow Layout" id="DIV1" runat="server">Label</DIV> 43
  • 44. 44
  • 45. Web Controls(As Server Controls) 45 Web Form Controls General Controls List Controls Validation Controls Ex:Textbox,Radio Button Ex:Data Grid,Data list Ex:Required Field,Range Field, Compare Field
  • 46. 46 General Controls This Control is used for general purpose as like inserting and updating Ex:Label,Textbox,Dropdown List etc..
  • 47. TEXTBOX:Its mainly used for getting input values from the users Id for textbox control(ex:txtename) To Set Maximum Length For a control(ex:if set 10 it allows 10 characters only) •Single-General •Multiple-When More Number of values entered (ex:Address) •Password-When We enter password character(ex:**** ) In Coding: TextBox1.Text=“hay”; 47
  • 48. Label:Its mainly used for give identification(ex:a book having label) Set id for the label(lblename) Set Font Style for the Control(ex:bold) Set some text for label(ex:Enter Ename) 48 Coding: Label1.Text=“hay”;
  • 49. Button:It used to perform some Action as like event(ex:Button Click) Set some styles for Button 49 Button ID Enter Some Text for Button Events for button
  • 50. 50 Link Button:Its used redirect one page to another page Id for Link Button Enter some text for Link Button Using response object the page should be redirected
  • 51. Set some alternative messages for image 51 Image Button:As Like Button control with some images Id For imagebutton(ex:imgbtn) Browse the image and select it When image button is clicked the textbox shoes the messages
  • 52. 52 Dropdown List:Adding multiple values(Ex:Date Of Birth) The is First way adding value in control (Dropdown-properties-items- collection-set text- Add-ok)As shown in fig(Ex:Month in DOB I.e Constant string Values) The second way adding value is coding as shown(ex:numeric values-day& month in DOB)
  • 53. List Box:Adding Multiple values with multiple selection 1.Adding values in List Box (List Box -properties-items-collection-set text- Add-ok)ex:Select More than area 1.Single:For selecting single value 2.Multiple:For selecting more than one using Ctrl Key Coding used for select the values from the control 53
  • 54. 54 Hyperlink:Make a link to next page This is to link one page to other page(Browse the url and select it) Text for hyperlink control
  • 55. Checkbox List:Its used to check more than one value from the control Adding values through collections This for selecting the value from the control. For selecting more than one values we should do for loop to make of multiple values 55
  • 56. Radio Button List:Its used to select the single value from the control As like other controls its also used add values in collections.In This control is used select the particular or singular value at a time. Ex:Select the Gender(male or Female) Display values as vertical This for selecting the value from the control. 56
  • 57. 57 Calendar:Display the current calendar in specified formats Represents the style for calendar control Getting values from the calendar control
  • 58. 58
  • 59. 59 Validation Controls •The validation control is used to check some condition for the control. •This control is activate as Server Control
  • 60. Control Name Description RequiredFieldValidator Ensures that the user does not skip an entry. 60 CompareValidator Compares a user's entry with a constant value or a property value of another control using a comparison operator (less than, equal to, greater than, and so on). RangeValidator Checks that a user's entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, or dates. Boundaries can be expressed as constants. RegularExpressionValidator Checks that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on. CustomValidator Checks the user's entry using validation logic that you code yourself. This type of validation allows you to check for values derived at run time. Validation Summary Displays the validation errors in summary form for all of the validators on a page.
  • 61. RequiredFieldValidator:Its is used to validate the function must to enter the field.Ex:Mandatory 61 Textbox Required Field Validator control Specified which control to be validate(ex:Textbox1) Enter some error message that should displayed
  • 62. CompareValidator:This used to compare two values should be same or not. Ex:Compare new and confirm Password Specify which control to compare Specify which control to validate Enter some messages to displayed 62
  • 63. RangeValidator:Check the range value(Ex:Minimum and Maximum value) Specify which control to validate Enter the maximum range value Enter The minimum range value 63
  • 64. Validation Summary:Its display the full error summary (Ex:yahoo new user registration form) For displaying error message format Select whether the the summary should be shown are not 64
  • 65. RegularExpressionValidator:Its used to specify some expressions as like email,phone numbers Enter the some error message In validation Expression select some expression what u need 65
  • 66. 66
  • 67. 67 List Controls The List controls belongs to web controls..The controls are 1. DataGrid 2. DataList 3. Repeater These controls are used select single/all the values from the database and display with some style formatting
  • 68. 68 Data Grid Displays data as a table Control over Alternate item Header Footer Colors, font, borders, etc. Paging Updateable Item as row Data grid contains auto format to display the grid effectively,For these Data Grid->Right Click->Auto Format->Select the style formats as our wish
  • 69. In the data Grid we can set paging,sorting and column designing using the Data Grid->Right Click->Property Builder->Columns 69 Data Grid In Columns it contain Bound Column Used to Give valid Column Name Button Column In-built button like edit,cancel,select Hyperlink Give Link to other Page Template Column Add extra column ex:check box Data grid get source from dataset
  • 70. 70 Data List Data List controls should as like data grid but without in-built button column •Directional rendering •Good for columns •Item as cell •Alternate item •Updateable Styles: In Data List it contains some pre-defined styles and alternating styles for display. In These every thing should be included in <item template> We can set the styles in HTML with tags or else dragging controls in <item template>
  • 71. 71 Data List For Binding values in data grid Its also take source from the dataset In Code-Behind Page_Load() In HTML Page In HTML page the column values should bind inside the item template tag and with other tags ex:table,label etc..
  • 72. 72 Repeater The repeater control is static one and does not have any user interfaces List format No default output More control More complexity Item as row Not updateable In HTML Compare to data list control it have only limited formatted style
  • 73. 73 Repeater In Web Form Page_Load( ) As like other List Control it take source from Dataset In HTML Page The column value should bind inside in item template and with data binder tag
  • 74. 74 components The components are used add some functionality built –in as component Ex:Timer
  • 75. 75
  • 76. 76 Data Controls •CCoonnnneeccttiioonn •CCoommmmaanndd •DDaattaaRReeaaddeerr •DDaattaaSSeett •DDaattaaAAddaapptteerr •DDaattaaVViieeww
  • 77. 77 Data Controls DDaattaabbaassee CCoonnnneeccttiioonn AAAAuuuuttththhhoooorrrsrsss DDaattaaAAddaapptteerr DDaattaaSSeett SSeelleecctt …… ffrroomm AAuutthhoorrss AAuutthhoorrss
  • 78. DDaattaabbaassee 78 Data Controls CCoonnnneeccttiioonn PPPPuuuubbbblliillsisisshhhheeeerrrrssss DDaattaaAAddaapptteerr DDaattaaSSeett SSeelleecctt …… ffrroomm PPuubblliisshheerrss AAuutthhoorrss PPuubblliisshheerrss
  • 79. 79 Data Controls DDaattaasseett AAuutthhoorrss PPuubblliisshheerrss DDaattaa VViieeww DDaattaa GGrriidd RReeppeeaatteerr DDaattaa LLiisstt
  • 80. 80
  • 81. 81 Contents 1. Into to State Management 2. Client State Management 1.1 Cookies 1.2 Query String 1.3 View State 3. Server State Management 3.1 Application 3.2 Session 3.3 Database Support
  • 82. 82 Introducing State Management State Management is a process of maintaining in application and session-related information when multiple users request for the same or different web pages of an Asp.Net application. State Management needed when the same user logs on to a web site for multiple times. In addition ,state management includes maintaining page-level information during the round trip of a Web Form page. Types 1.Client Side Management 2.Server Side Management
  • 83. 83 State Management Types 1.Client side Management • View State • Cookies • Query Strings 2.Server side Management • Application • Session • Database Support
  • 84. 84 View state The View state in an Asp.Net Web Form enable to retain page and control-specific values between round trips.Each web form and the controls on the page have the view state property that is inherited from the base control class.Asp.Net Frame work uses the view state property to automatically save the values of the page and each control prior to rendering the page. The view state is implemented with a hidden form field called _VIEWSTATE,which is automatically created in every web form .When Asp.Net executes a web page on a web server ,the values stored in the view state property of the page and controls on it are collected and formatted into a singe encoded string.The encoded string is then assigned to the value attribute of the hidden form field _VIEWSTATE and is sent to the client as a part of the web page.When the page is posted back to the server,the Asp.Net Framework parses the view state string at page initialized and restores the property information in the page By default the view state is enabled ,if we need we can disabled for a particular control. Advantages: The view state stored in a standard HTML format as a part of the web page. Easy to implement The Values in view state are hashed,compressed and encoded for Unicode implementation Disadvantages Page speed is slow when datas are high Security Less
  • 85. Cookies •A cookie is a small file that the server embeds on the user's computer .Each time the same computer requests a page with a browser, it will send the cookie too.Cookies can be either temporary or persistent.temporary cookie is exist in memory space of a browser,when the browser is closed,all the temp cookies lost.A persistent cookie is saved as a text file in the file system of the client computer. •Benefits Of Cookies •No server resources are required as they stored in client •They are light weight •Simple to use Limitations Of Cookies Most Browsers place a 4096-byte limit on the size of a cookie,although support for 8192-byte cookie is becoming more common in the new browser and client-device versions available today. •Some users disable their browser or client device’s ability to receive cookies,thereby limiting the use of cookies •Cookies can be tampered and thus creating a security hole. •Cookies can expire thus leading to inconsistency
  • 86. Query String Benefits •When we need to submit information back to a web page or another page by using URL .A query string provides a simple way to pass information from one page to another page. •The Query String is used to store and transfer the information through the URL. •It get the values from the Request Object. •No server resources are required.This query string containing in the HTTP requests for a specific URL •All browsers support query strings Query String Limitations •Query String data is directly visible to user thus leading to security problems •Most browsers and client devices impose a 255-character limit on URL length.
  • 87. 87 Session Session State is a collection of objects that are stored in the memory of the web server. But where is the Session State stored? In II5, Session State is stored in the memory of the process aspnet_wp.exe. In IIS6, by default all applications share the same application pool, i.e. the session state is stored in the memory of the process w3wp.exe The advantages of using session state are as follows: · Process independence · Ease of implementation · Durability · Scalability The disadvantages of using session state are: · Low Performance for large volumes of data · Overhead involved for serializing and de-serializing the Session data Session state in ASP.NET can be stored in one of the following three ways. • InProc • State Server • SQL Server
  • 88. Asp.Net provides state as means of storing global application-specific information in the application state is is stored in a key-value pair and is used to maintain data consistency between server round trips and between pages. •The Application object is used to store and access variables from any page, just like the Session object. •The difference is that ALL users share one Application object, while with Sessions there is one Session object for EACH user. • The Application object should hold information that will be used by many pages in the application •Application variables can be accessed and changed by any page in the application. •You can create Application variables in "Global.asax" 88 Application
  • 89. Database support Database support is used to combination with cookies or session state.For ex,for an e-commerce web site ,you can maintain state information by using a relational database. Advantages 1. Security 2. Consistency 3. Personalization Disadvantages 1. Data base for state management involves complex hardware and software configurations 2. The web site may go down poor construction of the relational data model that is used to support session state in a web application.
  • 90. 90
  • 91. 91 Contents 1.Page And its Life Cycle 2.Request And Response 3.Session And Application 4.Demo:Using the objects in application
  • 92. 92 Page Life Cycle Page_Init: During this event, you can initialize values or connect any event handlers that you may have. Page_Load: During this event, you can perform a series of actions to either create your ASP.NET page for the first time or respond to client-side events that result from a post. The page and control view state have been restored prior to this event. Use the IsPostBack page property to check whether this is the first time that the page is being processed. If it is the first time, perform data binding. Also, read and update control properties. Page_DataBind: The DataBind event is raised when the DataBind method is called at the page level. If you call DataBind on individual controls, it only fires the DataBind event of the controls beneath it. Page_PreRender: The PreRender event is fired just before the view state is saved and the controls are rendered. You can use this event to perform any last minute operations on your controls. Page_Unload: After a page has finished rendering, the Page_Unload event fires. This event is a good place to perform final cleanup work. This includes items such as the cleanup of open database connections, discarding objects, or closing those files that are open.
  • 93. 93 Response and Request objects • Response Response object is used to send output to the user from the server – Represents the client browser – Response.Redirect(“Webform2.aspx”) – Response.Cookies[“Username”] = “Bob” • Request Request object is used to get information from the user – Represents the server – Request.PhysicalApplicationPath – Username = (String)Request.Cookies[“Username”]
  • 94. 94 Session and Application variables Session variables – Hash table-style collection of name-value pairs – Remembered until the client closes the browser (or the session timeout expires – default 20 minutes) – Only for one client – Session[“Valid User”] = true Application variables – Hash table-style collection of name-value pairs – Always remembered – For all clients – Application[“NumClients”] = NumClients + 1
  • 95. 95
  • 96. 96 Open The Asp.Net Web Application And Choose the Web Form Webform1
  • 97. 97 Create Table And Place The Controls Tables $Controls
  • 98. In Code-Behind Write Coding For Creating Cookies,Session And Query String Session Cookies 98 Query String
  • 99. Select the Another Web Form And Place The Controls 99
  • 100. In WebForm2 Code Behind Write the coding how to retrieving the values from cookies,session and Query String 100 Session Cookies Query String
  • 101. 101 Type The Values As 98,99 how it transform to next page
  • 102. Ya ..Now it Get Back The values From First page Using These Objects 102
  • 103. 103 Create Web form And write in page_load( ) event application Object Application Object
  • 104. 104 In First time the count shows 1
  • 105. After Refreshing the the page the count should be increased(Now its 3) 105 Enlarge
  • 106. 106
  • 107. 107 Contents 1. Global.Asax File 1.1 Global Programming 2. Web.Config file 2.1 Session Variables 3. Business Objects
  • 108. 108 ASP.NET Web Applications • Global ASAX – Application_Start – Application_End – Session_Start – Session_End • Session • Application
  • 109. 109 Global Programming (Global.asax) • Define Application Global methods, constants, variables • Global Event Handling – Application_Start – Session_Start – Application_Begin Request – Application_Authenticate Request • Useful for setting up custom Page.User and roles – Application_Error – Session_End – Application_End
  • 110. 110 The Web.config file • Configuration management for ASP.NET • XML file • Hierarchical structure MMaasstteerr ssyysstteemm mmaacchhiinnee..ccoonnffiigg AApppp AA wweebb..ccoonnffiigg AApppp BB wweebb..ccoonnffiigg AApppp BB ssuubbddiirr wweebb..ccoonnffiigg
  • 111. 111 web.config • Site configuration file • Like an .INI file for your site • XML format • Extensible • Some settings – Security – Session – Localization – Tracing – Debugging
  • 112. 112 Session Variables • Store state information • No longer require cookies • Share between servers <sessionState mode=“StateServer“ stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1; user id=sa;password="cookieless="false" timeout="20" SessionState/>
  • 113. 113 Business Objects • Not registered – Placed in ./bin directory • Not locked – Shadow copy
  • 114. 114
  • 115. 115 Contents 1.Introduction about Assembly 2.Assembly Architecture 3. Manifest Functions 4. Single/Multi File Assembly 5.Assembly Types 5.1 Private Assembly 5.2 Public Assembly 5.3 Global Assembly Cache 6.Assembly Location
  • 116. 116 ASSEMBLY Assemblies are the building blocks of .NET Framework applications It form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. Dynamic assemblies are run directly from memory and are not saved to disk before execution. Dynamic assemblies are stored on the disk after they have executed.
  • 117. 117 ASSEMBLY Architecture In general, a static assembly can consist of four elements:  The assembly manifest, which contains assembly metadata.  Type metadata.  Microsoft intermediate language (MSIL) code that implements the types.  A set of resources. Assembly Metadata Metadata MSIL Resources An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes.  The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information.
  • 118. 118 MANIFEST FUNCTIONS: Assembly Metadata is stored in Manifest contains all the Metadata needed to do the following things • Version of assembly • Security identity • Scope of the assembly • Resolve References to resources and classes ASSEMBLY BENEFITS Enable developers to specify version rules between different software components.  Provide the infrastructure to enforce versioning rules. Provide the infrastructure to allow multiple versions of a component to be run simultaneously (called side-by-side execution). NAMESPACE: System.Reflection Namespace System.Reflection namespace contains classes and interfaces that provide a managed view of loaded types, methods, and fields, with the ability to dynamically create and invoke types.
  • 119. 119 SINGLE-FILE ASSEMBLY Group all elements in a single physical file Assembly Manifest Type Metadata MULTIFILE ASSEMBLY MSIL code Resources Assembly Metadata Type Metadata MSIL code Type Metadata MSIL code MSIL code The elements of an assembly can be contained in several files. These files can be modules of compiled code, resources (such as .bmp or .jpg files), or other files required by the application.
  • 120. 120 ASSEMBLY TYPES There are Two types  Private Assembly  Public Assembly PRIVATE ASSEMBLY: •A Private assembly is normally used by single application, and is stored in the application’s directory or a sub directory PUBLIC ASSEMBLY: •A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. •Shared assemblies are usually libraries of code Ex: Crystal report classes – used by all application for Reports
  • 121. 121 GLOBAL ASSEMBLY CACHE •GAC is used where shared .NET assembly reside. •GAC is used in the following situations •If the application has to be shared among several application •If the assembly has some special security requirements like only administrators can remove the assembly. •If the assembly is private then a simple delete of assembly the assembly file will remove the assembly ADD AND REMOVE AN ASSEMBLY FROM GAC gacutil [options] [assemblyName | assemblyPath | assemblyListFile] assemblyName The name of an assembly. You can supply either a partially specified assembly name such as myAssembly or a fully specified assembly name such as myAssembly, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0038abc9deabfle5.
  • 122. 122 assemblyPath The name of a file that contains an assembly manifest. assemblyListFile •The path to an ANSI text file that lists assemblies to install or uninstall. •To use a text file to install assemblies, specify the path to each assembly on a separate line in the file. The tool interprets relative paths, relative to the location of the assemblyListFile. •To use a text file to uninstall assemblies, specify the fully qualified assembly name for each assembly on a separate line in the file. Examples The following command installs the assembly mydll.dll into the global assembly cache. gacutil /i mydll.dll The following command removes the assembly hello from the global assembly cache as long as no reference counts exist for the assembly. gacutil /u hello For example, if both version 1.0.0.0 and 3.2.2.1 of hello are installed in the cache, the command gacutil /u hello removes both of the assemblies.
  • 123. Use the following example to avoid removing more than one assembly. This command removes only the hello assembly that matches the fully specified version number, culture, and public key. gacutil /u hello, Version=1.0.0.1, Culture="de",PublicKeyToken=45e343aae32233ca 123 Strong-Name Assemblies •Strong name is similar to GUID (It is supposed to be unique in space and time) in COM components. •Strong name is only needed when we need to deploy assembly in GAC. •Strong names helps GAC to differentiate between two versions. Sn.exe –k “C:test.snk”
  • 124. 124 ASSEMBLY LOCATION An assembly's location determines whether the common language runtime can locate it when referenced, and can also determine whether the assembly can be shared with other assemblies. You can deploy an assembly in the following locations: The application's directory or subdirectories. • This is the most common location for deploying an assembly. • The subdirectories of an application's root directory can be based on language or culture. • If an assembly has information in the culture attribute, it must be in a subdirectory under the application directory with that culture's name. The global assembly cache. • This is a machine-wide code cache that is installed wherever the common language runtime is installed. • In most cases, if you intend to share an assembly with multiple applications, you should deploy it into the global assembly cache. On an FTTP server. • An assembly deployed on an FTTP server must have a strong name; you point to the assembly in the code base section of the application's configuration file.
  • 125. 125
  • 126. 126 Contents 1. Caching Introduction and its Types 2. Output caching 3. Fragment Caching 4. Data Caching 4.1 Cache APIs 4.2 Adding Items to cache 4.3 Cache.Add Method 4.4 Parameters 5. Additional Caching Features 5. Caching Features in .Net 1.1
  • 127. 127 CACHING DEFINITION Caching involves temporarily storing the frequently used data for the Web application on local hard disks for later retrieval. As a result, the web server on which the application resides processes requests for the Website only once and caches the requests for future. Any subsequent requests are processed from the cache instead of the Webserver.The data can be cached either at the client side or at the server side. • Client The data is stored in temporary files on the hard disk or in memory of the clients computer. • Server Microsoft Proxy Servers are generally used for caching. ASP.NET has a powerful, easy-to-use caching mechanism that allows you to store objects that require a large amount of server resources to create in memory. It is implemented by the cache class. • The Cache class has been designed for ease of use. By using keys paired with values, you can place items in the Cache and later retrieve them. • when system memory becomes scarce, the cache automatically removes seldom used or unimportant items to allow memory to be used to process a high volume of requests. This technique is called scavenging.
  • 128. 128 1.OUTPUT CACHING Output caching allows you to store the results that a dynamic page generates. On subsequent requests, the cached output is used to satisfy the request rather than dynamically executing the page code. Output caching is also referred to as page caching. The following sample illustrates how to cache the output of the page for 30 seconds: Visual C# .NET Sample <%@ Page Language="C#" %> <%@ OutputCache Duration="30" VaryByParam="*" %> To use the @ OutputCache directive to control page output caching, you simply add the directive to the top of the page. The Page.InitOutputCache method translates the directive into HttpCachePolicy class methods. The @ OutputCache directive includes the following attributes and settings: Duration: This attribute specifies how long an item is held in the cache. The value for Duration is listed in seconds. VaryByParam: This attribute determines cache entries by Get or Post parameters. For example, if a QueryString variable named testVal is set for the VaryByParam attribute, every page request that contains a different value for testVal is cached in a separate page.
  • 129. Output caching @ OutputCache directive contains a Location attribute. This attribute determines the location for cached item. You can specify the following locations: Any This stores the output cache in the client's browser, on the proxy server (or any other server) that participates in the request, or on the server where the request is processed. By default, Any is selected. Client •This stores output cache in the client's browser. Downstream •This stores the output cache in any cache-capable devices (other than the origin server) that participate in the request. Server •This stores the output cache on the Web server. None • This turns off the output cache. 129 Visual C# .NET Sample <%@ Page Language="C#" %> <%@ OutputCache Duration="30" VaryByParam="*" %>
  • 130. 130 2.FRAGMENT CACHING Fragment caching is useful when you need to cache only a subset of a page. This is accomplished by caching the outputs of a user control. Navigation bars, headers, and footers are good candidates for fragment caching. • The fragment caching is implemented through User Controls. • The fragments of the page that will be cached are placed in one or more User Controls. •The User Controls are then included in different pages as desired. • The caching options for the controls are specified by placing an OutputCache directive within each control or programmatically in the code behind using the PartialPageCachingAttribute. •The caching parameters are set on the individual controls rather than within the page itself. •The User Controls are then cached independently according to each directive, while the remainder of the page content remains dynamic and uncached.
  • 131. 131 3. DATA CACHING  Data caching is where the majority of the control is handled programmatically.  The Cache class located in the System.Web.Caching namespace is the way in which items are added into and retrieved from the ASP.NET cache.  It is relatively straightforward to use in your Web applications.  The Cache class provides a dictionary type interface, which means you assign a key to the value when it is stored.  The key is used to access the value again at a future point in time when it is needed. 1.Using a name value pair similar to a Dictionary object. Example: Cache[“keyName”] = “MyValue”; Example: Cache[“keyName2”] = myObject;
  • 132. DATA CACHING Example 2.Using the Cache.Add method, which returns an object representing the item added into the cache. If an object with the given key name already exists in the cache, then the Add method will fail. 132 Example: Cache.Add(“keyName”, “MyValue”); Example: Cache.Add(“keyName2”, myObject); 3. Using the Cache.Insert method, which, unlike the Insert method, does not have a return type. In addition, if an item already exists in the cache with the given key name, the Insert method will override it with the new value given. Example: Cache.Insert(“keyName”, “MyValue”); Example: Cache.Insert(“keyName2”, myObject);
  • 133. 133 CACHE APIS Cache Application Programming Interfaces (APIs) allow you to programmatically store arbitrary objects to memory so that your application can save the time and resources that it takes to re-create them. Cache APIs allow you to expire items from the cache based on the following credentials: •Time •File dependencies •Cache key dependencies The Cache class has been designed for ease of use. By using keys paired with values, you can place items in the Cache and later retrieve them. You can instruct the Cache to give certain items priority over other items when it performs scavenging. To indicate that a specific item is of greater or lesser importance than another, specify one of the CacheItemPriority enumeration values when you add an item using the Cache.Add method or Cache.Insert method.
  • 134. 134 ADDING ITEMS TO THE CACHE There are three different techniques you can use to add an item to the Cache object. If you want to take advantage of the scavenging, expiration, and dependency support offered by the Cache, you must use either the Cache.Insert method or the Cache.Add method. Cache.Insert Method (String, Object) Inserts an item into the Cache object with a cache key to reference its location and using default values provided by the CacheItemPriority enumeration [C#] publicvoid Insert( string key, object value ); PARAMETERS key The cache key used to reference the item. value The object to be inserted into the cache. The following example demonstrates how to insert an item into an application's cache. [C#] Cache.Insert("DSN", connectionString);
  • 135. 135 PARAMETERS key The cache key used to reference the item. value The item to be added to the cache. dependencies The file or cache key dependencies for the item. When any dependency changes, the object becomes invalid and is removed from the cache. If there are no dependencies, this paramter contains a null reference. absoluteExpiration The time at which the added object expires and is removed from the cache. slidingExpiration The interval between the time the added object was last accessed and when that object expires. If this value is the equivalent of 20 minutes, the object expires and is removed from the cache 20 minutes after it is last accessed. priority The relative cost of the object, as expressed by the CacheItemPriority enumeration. The cache uses this value when it evicts objects; objects with a lower cost are removed from the cache before objects with a higher cost. onRemoveCallback A delegate that, if provided, is called when an object is removed from the cache. You can use this to notify applications when their objects are deleted from the cache.
  • 136. CACHING FUNDAMENTALS IN ASP.NET FRAMEWORK 1.1 Cache • A static object with a collection dedicated to storing and processing cache information (System.Web.Caching.Cache). Cache Dependency • It is a mechanism through which the cache data can be made dependant on any file or a key data present in the cache itself. Cache Expiration • It provides a way to provide expiration to the data available in the cache. Cache Callback •: It is a delegate, which can be associated with any cache item. It is invoked when the associated item in the cache expires due to any reason. The expiration reasons can be any of the following 1. Removed: The item is explicitly removed from cache. 2. Expired: The item’s time is expired due to cache time out or its own 136 expiration policy settings. 3. Underused: The cache item is removed from the cache due to shortage of resources. 4. Dependency Changed: The cache item is removed from the cache because its dependency has been changed.
  • 137. 137
  • 138. 138 Contents 1.Authentication 1.1 Authentication Options 1.2 Form Authentication 1.3 Demo 2.Authorization
  • 139. 139 AUTHENTICATION THIS IS WHO I AM Authentication is the process of deciding who can access the application. User name and Password is the most common mechanism for Authentication. Authentication means validating a user based on set of credentials Authorization occurs after authentication. Ex: such as E-mail, username, and password. Authorization requires specifying access restrictions and permissions for your users. Hence,these terms are different but interrelated.
  • 140. Authentication Accepted Authentication Rejected Display Content Redirect To Registration As you see in the above diagrams,when a user enters the 140 application,two possible courses of action occur. 1.The user is authenticated,so the requested content is returned. 2.The user is not authenticated and is sent to a registration form.Once the registration process is successful,then and only then is the requested content returned.
  • 141. 141 Options Available  Forms Authentication : Login request are made by filling form in a web page and submitting that form to the server.  Windows Authentication : Login pages pass user credentials to a web server.The web server then handles the authentication using which ever method is configured on the virtual directory that the application is running within.  Passport Authentication : Authentication is performed via a centralized authentication provided by Microsoft.
  • 142. FORMS AUTHENTICATION MODEL BROWSER SERVER Browser request page B and passes a copy of the cookie 142 Browser sends request for page A to the server Server refuses anonymous access and sends login page instead Browser sends a login request to the server BROWSER SERVER Server authenticates and returns page A along with a cookie to the browser BROWSER SERVER Server accepts cookie and sends back page B
  • 143.  Forms authentication handles authentication using your own custom logic with an ASP.NET application.  When a user requests a page for the application, ASP.NET checks for the presence of a special session cookie.If the cookie is present,ASP.NET assumes the user is authenticated and process the request.  If the cookie isn’t present,ASP.NET redirects the user to a Webform you provide. 143 Forms Authentication Using a Web.Config file <configuration> <system.web> <authentication mode="Forms"> <forms name="logincookies" loginUrl="login.aspx” protection="All" timeout="30“ path="/" /> </authentication> <authorization> <deny users="?" /> </authorization> </system.web> </configuration> Attributes Description •Name Name of the authentication cookie •LoginUrl The login page to which unauthenticated users should be redirected. •Protection Protect the authentication cookie •Timeout The timeout value for the cookie to expire.
  • 144. Checking the username and password through Authentication Enter the Username And Password in Textbox 144
  • 145. The username is not valid then it display the error message 145
  • 146. 146
  • 147. 147 AUTHORIZATION what I can do: When user name and password matches it checks to see what permission you have been granted. DEFINITION The process of granting a user the permission to use a resource, or denying them access to a resource or a group of resources. Coding <authorization> <deny users="?" /> </authorization>
  • 148. 148 Tag Description Deny This can take three attributes. 1. User: User name can be particular user name or ? Anonymous users. 2.Role: Describes particular role such as administrator. 3.Verb: set to a particular request. Allow This can take three attributes 1. User: User name can be particular user name or ? Anonymous users. 2.Role: Describes particular role such as administrator. 3.Verb: set to a particular request.
  • 149. 149
  • 150. 150 Debugging ASP.NET • Using Visual Studio .NET debugging tools – Breakpoints – Stop keyword – System.Diagnostics.Debug – Command/Immediate Windows – Add Watch/Quick Watch – Autos/Locals Windows • Trace • Client Script Debugging – Active Documents – Debugger keyword
  • 151. 151
  • 152. 152 Contents 1.Intro to Tracing 2.Page Level Tracing 2.1 Write Trace Contents 3.Application Level Tracing 3.1 Viewing Trace
  • 153. 153 Tracing  ASP.NET introduces new functionality that allows you to view diagnostic information about a single request for an ASP.NET page simply by enabling it for your page or application.  In order for these messages and other tracing information to be gathered and displayed, we must enable tracing for the page or application.  Trace statements are processed and displayed only when tracing is enabled. You can control whether tracing is displayed to a page, to the trace viewer, or both. Types: 1.Page-Level Tracing 2.Application-Level Tracing
  • 154. 154 Page Tracing Page-Level Tracing We can control whether tracing is enabled or disabled for a page with the Trace attribute of the @ Page directive. Regardless of whether the write messages to the trace log, when you enable tracing and the page is requested, ASP.NET appends a series of tables containing performance information about the page request. Tracing is disabled by default. If you do not include a Trace attribute in your page, trace information is not gathered, and trace statements you write do not appear on the page. To enable tracing for a page Include an @ Page directive at the beginning of your .aspx file. Include the Trace attribute, and set its value to true. <%@ Page Trace="true" %> Security Note When tracing is enabled for a page, trace information is displayed on any browser that makes a request for the page from the server. Tracing displays sensitive information, such as the values of server variables, and can therefore represent a security threat. <%@ Page Language=“C#" Trace="True" TraceMode="SortByCategory" %>
  • 155. 155 Output For Page Info The information of page should be shown here
  • 156. 156 Writing Trace Messages ASP.NET uses the Trace Context class to store information about a request, its control hierarchy, and trace information. The TraceContext class is available to Web Forms pages through the Page Trace property. Current property to access the TraceContext class. In this case, use HttpContext.Current.Trace syntax. The TraceContext class provides two methods, Write and Warn, which allow you to write statements to the trace log. Each method is overloaded and allows you to specify a tracing category, a text message, and optional error information. The only difference between these methods is that the Warn method displays its text in red. The first is treated as a category, which you can use to sort where your messages appear in the Trace Information table that is displayed when tracing is enabled. The Second argument is of type Exception and contains error information for the request, if there is any.
  • 157. Page Trace Output with Warn And Write Methods Warn( ) Messages Write() Messages 157
  • 158. 158 Application-Level Tracing To enable tracing for an application 1. If you have not done so already, create a text file, name it Web.config, and save it to your application's root directory. 2. Between the opening and closing tags of the <configuration> element, add the opening and closing tags of a <system.web> element. 3. Between the <system.web> element tags, add a <trace> element, which is self-closing. 4. In the <trace> element, declare the enabled attribute and set it to true. 5. Declare other optional attributes to modify your application's trace behavior, as you want. For example, the following application trace configuration collects trace information for up to 40 requests and allows browsers on computers other than the origin server to display the trace viewer. <configuration> <system.web> <trace enabled="true" requestLimit="40" localOnly="false"/> </system.web> </configuration>
  • 159. Viewing Trace Information with the Trace Viewer • To view these statements and the additional trace information in the trace viewer by requesting Trace.axd from the root of your application directory. •To enable set the pageOutput attribute to true in the Web.config file. Traced Application Information 159
  • 160. 160
  • 161. 161 Contents 1. Introduction About Web Services 2. Usage Of Web Services 3. SOAP 4. WSDL And UDDI 5. Internet Towards Web services 6. Demo with illustration
  • 162. 162 Web Services What are Web Services? • Web services are application components • Web services communicate using open protocols • Web services are self-contained and self-describing • Web services can be discovered using UDDI • Web services can be used by other applications • XML is the basis for Web services The basic Web services platform is XML + HTTP. • The HTTP protocol is the most used Internet protocol. • XML provides a language which can be used between different platforms and programming languages and still express complex messages and functions. Web services platform elements • SOAP (Simple Object Access Protocol) • UDDI (Universal Description, Discovery and Integration) • WSDL (Web Services Description Language)
  • 163. 163 Web services and its uses Reusable application components There are things different applications needs very often.  Web services can offer application components like currency conversion, weather reports or even language translation as services.  Ideally, there will only be one type of each application component, and anyone can use it in their application. Connect existing software Web services help solve the interoperability problem by giving different applications a way to link their data. Using Web services you can exchange data between different applications and different platforms. Web Services have three basic platform elements These are called SOAP, WSDL and UDDI.
  • 164. 164 What is SOAP? The basic Web services platform is XML plus HTTP. •SOAP stands for Simple Object Access Protocol •SOAP is a communication protocol •SOAP is for communication between applications •SOAP is a format for sending messages •SOAP is designed to communicate via Internet •SOAP is platform independent •SOAP is language independent •SOAP is based on XML •SOAP is simple and extensible •SOAP allows you to get around firewalls •SOAP will be developed as a W3C standard
  • 165. 165 WDSL And UDDI WSDL WSDL is an XML-based language for describing Web services and how to access them. •WSDL stands for Web Services Description Language •WSDL is written in XML •WSDL is an XML document •WSDL is used to describe Web services •WSDL is also used to locate Web services •WSDL is not yet a W3C standard What is UDDI? UDDI is a directory service where businesses can register and search for Web services. •UDDI stands for Universal Description, Discovery and Integration •UDDI is a directory for storing information about web services •UDDI is a directory of web service interfaces described by WSDL •UDDI communicates via SOAP •UDDI is built into the Microsoft .NET platform
  • 166. Heading towards a new model for the Internet WWeebb SSeerrvviiccee 166 XXMMLL ““BBuuiillddiinngg BBlloocckk SSeerrvviicceess”” WWeebb SSeerrvviiccee HTML CClliieenntt DDeevviiccee XML CClliieenntt DDeevviiccee XXMMLL WWeebb SSeerrvviiccee XML WWeebb SSeerrvviiccee XXMMLL XXMMLL
  • 167. 167 Web Services PPuurrcchhaassee ccoouurrsseewwaarree PPuurrcchhaasseedd DDeessiiggnneedd ffoorr ppeeooppllee ttoo bbrroowwssee
  • 168. 168 Web Services PPuurrcchhaassee CCoouurrsseewwaarree ? Server ttoo sseerrvveerr iiss aa pprroobblleemm
  • 169. 169 Web Services PPuurrcchhaassee CCoouurrsseewwaarree ? Server ttoo sseerrvveerr iiss aa pprroobblleemm
  • 170. 170 Web Services • Allow applications to communicate across the Internet • Platform independent • Protocol independent • Synchronous/asynchronous • Stateful/stateless • BizTalk® • ASP.NET
  • 171. 171 Web Services ..AA..AASSSSMMMMXXXX Class Courseware Class Courseware WebMethod WebMethod GetPrice Purchase GetPrice Purchase
  • 172. 172 Web Services ..A.AASSSSMMMMXXXX TTeessttiinngg CCoouurrsseewwaarree..aassmmxx TTeesstt HHTTMMLL PPaaggee
  • 173. 173 Web Services ..AA..AASSSSMMMMXXXX CCoouurrsseewwaarree..aassmmxx??WWSSDDLL SSeerrvviiccee DDeeffiinniittiioonn((XXMMLL)) PPrrooxxyy DDLLLL PPrrooxxyy DDLLLL WWSSDDLL
  • 174. RReeggiisstteerr ffoorr CCoouurrssee PPuurrcchhaassee CCoouurrsseewwaarree 174 Web Services PPrrooxxyy DDLLLL PPrrooxxyy ..A.AASSSSMMMMXXXX DDLLLL
  • 175. 175
  • 176. 176 Contents 1. Ajax Introduction 2. Ajax Transaction 3. Http Request in Ajax 4. Non-Ajax 5. Ajax Enabled 6. Using Ajax 7. Demo
  • 177. AJAX ● Asynchronous – Communication can take place with the server as the user is interacting with the page. ● JavaScript – Coding is done in JavaScript which is close to cross browser compatible 177 ● And ● XML – The original design was for data to be passed back and forth using XML (i.e. Web Services). As we will see, there are now other methods of passing data as well.
  • 178.  AJAX is not a new programming language, but a technique for creating better, faster, and more interactive web applications.  With AJAX, your JavaScript can communicate directly with the server, using the JavaScript XMLHttpRequest object. With this object, your JavaScript can trade data with a web server, without reloading the page  AJAX uses asynchronous data transfer (HTTP requests) between the browser and the web server, allowing web pages to request small bits of information from the server instead of whole pages.  With an HTTP request, a web page can make a request to, and get a response from a web server - without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.  AJAX is a browser technology independent of web server software. 178 AJAX Transaction
  • 179. 179 Requests usage in AJAX The XMLHttpRequest Object By using the XMLHttpRequest object, a web developer can update a page with data from the server after the page has loaded! AJAX was made popular in 2005 by Google (with Google Suggest). Google Suggest is using the XMLHttpRequest object to create a very dynamic web interface: When you start typing in Google's search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions. The XMLHttpRequest object is supported in Internet Explorer 5.0+, Safari 1.2, Mozilla 1.0 / Firefox, Opera 8+, and Netscape 7.
  • 180. Web Browser Web Server www.mypage.com 180 User http://www.myPage.com/ Page GET / Non-Ajax
  • 181. 181 Non-Ajax Web Browser (Default.aspx) User views new page Web Server User Some Interaction www.mypage.com POST Form Variables Refresh entire page
  • 182. 182 Ajax Enabled 1st part same as before Web Browser Web Server www.mypage.com User http://www.myPage.com/ GET / Page
  • 183. 183 Ajax Enabled Here is the different Web Browser (Default.aspx) Javascript updates DOM Web Server www.mypage.com User Some Interaction Asynchronous Data Chunk HTTP Callback
  • 184. 184 Using AJAX Add reference ajax.dll to your project Modify your web.config to configure IHttpHandler for Ajax.NET requests Write your methods in C#/VB.NET and add the attribute [AjaxMethod] Call Class1.Method1(param1, param2, callback, context); from client-side JavaScript
  • 185. Using AJAX Methods only get attribute, no need to implement 185 interface or inherit from class [AjaxMethod] public int GetAge(string username){…} Source-code doesn‘t change if you want to use the method in server-side code DemoMethods dm = new DemoMethods(); int age = dm.GetAge(“michael“); WebServices can be used without code change: <script type= “text/javascript“ src=“servie1.asmx?AJAX“></script>
  • 186. 186 Open The Web Application In Solution Explorer choose the add reference
  • 187. In The Add Reference box choose the AJAX dll 187
  • 188. Browse the path where the Ajax.dll located 188
  • 189. Add the dll to our application 189
  • 190. Here the reference should added 190
  • 191. 191
  • 192. 192 Demo : Add two values using AJAX
  • 193. 193
  • 194. 194
  • 195. 195 The values Added using AJAX
  • 197. 197

Editor's Notes

  1. KEY MESSAGE: The strengths of Classic ASP. SLIDE BUILDS: None SLIDE SCRIPT: For its time, ASP was a revolution. Server-side processing was in its infancy. Server-side processing was complex. ASP was easy, and, with COM, powerful. It allowed dynamic generation of HTML, and used VBScript to reduce the learning curve. SLIDE TRANSISTION: But ASP had some limitations. ADDITIONAL INFORMATION FOR PRESENTER:
  2. KEY MESSAGE: There are some limitations and issues with ASP. SLIDE BUILDS: None SLIDE SCRIPT: You can have many languages intermixed in a single ASP. I once had a single ASP with 7 languages (VBScript, JavaScript, HTML, CSS, SQL, XML, XSL). This can be unreadable and unmaintainable. Some seemingly simple things, like making a table that shows data from the database, require a lot of code - too much code. You are constantly pushing state information down to the client so that it can be posted back to the server. ASP had a simple “file include” model. There was no good way to make classes. If you used Visual Basic, then you fought DLL issues like locking. If you created server-side scriptlets, then you didn’t have any debugging. ASP pages were interpreted every time they executed. There’s a performance penalty for this over something like ISAPI applications. If an ASP page used a DLL, then that DLL was locked until you shut down the Web application, or the Web server (if the app ran in-process). This made developing DLLs difficult and slow. Deployment was a challenge because the application might need DLLs, that may or may not have been registered in MTS or Component Services, in addition, there may be configuration settings outside of the Web. For example, a Web site might depend on registry settings, or setting in the metabase.
  3. &amp;lt;number&amp;gt; RCW is the runtime callable wrapper, handles the interface between ASP.NET code and the unmanaged COM object
  4. &amp;lt;number&amp;gt;
  5. KEY MESSAGE: Regardless of the language, you’re using the same run-time SLIDE BUILDS: None SLIDE SCRIPT: With ASP.NET you have a number of languages to choose from. Regardless of the language, the page will be compiled on the first request. Also regardless of the language, you’ll be using exactly the same runtime. The runtime provides for common functionality among the languages, and insulates your code from the operating system. SLIDE TRANSISTION: Let’s look at some of the key features of ASP.NET ADDITIONAL INFORMATION FOR PRESENTER: We already know that an assembly does not contain native binary code, but instead MSIL code. Obviously before the MSIL code can be executed it must be converted into native binary instructions. Converted? Does this mean interpreted? No. The MSIL code is compiled and not thrown away. This means that next time the code is requested it is already in the form of machine instructions and thus this mechanism in the long run is far more efficient than an interpreter for example.
  6. &amp;lt;number&amp;gt;
  7. &amp;lt;number&amp;gt;
  8. KEY MESSAGE: Connection and Data Set Command SLIDE SCRIPT: A DataSet holds a snapshot of data from the database. SLIDE BUILD: The connection object lets you converse with a database. SLIDE BUILD: A DataAdapter contains the instructions to retrieve data from the database, or update the database. SLIDE BUILD: After this command executes, the DataSet contains a snapshot of the data. SLIDE TRANSISTION: Data controls ADDITIONAL INFORMATION FOR PRESENTER:
  9. KEY MESSAGE: DataSet holds data from more than one table. SLIDE SCRIPT: SLIDE BUILD: A data set can store information from more than one table. For example, the publishers table. SLIDE BUILD: The dataset maintains a static view of each set of data. SLIDE BUILD: With an additional line of code, we can tell the DataSet about the relationship between the tables. This will allow us to easily get the publisher for an author, or all the authors for a publisher. SLIDE TRANSISTION: DataView ADDITIONAL INFORMATION FOR PRESENTER:
  10. KEY MESSAGE: DataView allows data binding SLIDE SCRIPT: SLIDE BUILD: A data view provides sorting and filtering capabilities for a dataset. SLIDE BUILD: A data view also provides the functionality needed for data binding. SLIDE TRANSISTION: DataGrid ADDITIONAL INFORMATION FOR PRESENTER:
  11. KEY MESSAGE: Global.asax will be reassuringly familiar. SLIDE BUILDS: None SLIDE SCRIPT: Application_Start and Application_End get triggered every time someone hits an ASP.NET page (aspx, asmx). It does not get triggered by requests to .asp pages. Session_Start and Session_End get triggered each time a new user hits an ASP.NET page. We have the same session and application variables that we’ve always had with ASP, but we’ll see that Session has been enhanced. SLIDE TRANSISTION: web.config ADDITIONAL INFORMATION FOR PRESENTER:
  12. KEY MESSAGE: One file for the site configuration SLIDE BUILDS: None SLIDE SCRIPT: Web.config contains the configuration information for your site. It’s a text file. It’s in XML format. It’s in the root directory for your site, so it’s easy to deploy. Contains setting that control the overall behaviour of your site. SLIDE TRANSISTION: Enhancements to Session variables ADDITIONAL INFORMATION FOR PRESENTER:
  13. KEY MESSAGE: Session variables are enhanced SLIDE BUILDS: None SLIDE SCRIPT: Used to store state information for a user. For example, a shopping basket. Can use cookies, or be cookieless. In the case of cookieless, every URL output by the ASP is modified automatically to contain a session ID. There’s a service called “ASP State” that listens for requests for state information. By setting up one machine as the “State Server”, and pointing all the other boxes at it, session state can be shared across a Web farm. SLIDE TRANSISTION: Let’s look at this in action. ADDITIONAL INFORMATION FOR PRESENTER:
  14. KEY MESSAGE: .NET solves these headaches. SLIDE BUILDS: None SLIDE SCRIPT: DLLs in .NET aren’t registered. When you create an instance of an object, the .NET framework searches the DLLs in a specified path looking for an “assembly” that provides this functionality. It starts with a BIN directory that is local to the Web application. This makes it simple for different Web applications to use different versions of the same DLL. They each have their own copy. This also simplifies deployment. If the DLL is under the Web directory, you can just copy that directory, and have everything that the site needs. It also simplifies installing because nothing needs to be registered on the target system. ASP.NET pages don’t lock DLLs. When you create an instance of an object, the ASP.NET framework first makes a “shadow” copy of that DLL. It uses this shadow copy, and the original DLL remains unlocked. This allows you to update the DLL at will. The framework detects that the original DLL is newer than the shadow copy, and subsequent requests will use the new DLL. SLIDE TRANSISTION: Link to the next slide, introducing it ADDITIONAL INFORMATION FOR PRESENTER:
  15. KEY MESSAGE: Intro slide SLIDE BUILDS: None SLIDE SCRIPT: Intro these topics SLIDE TRANSISTION: The Web Today ADDITIONAL INFORMATION FOR PRESENTER:
  16. KEY MESSAGE: The Web today is for people to browse SLIDE SCRIPT: SLIDE BUILD: Today, a user browses Web pages, and can make requests. SLIDE BUILD: The response is sent using HTML. This allows people to interact and make purchases. SLIDE TRANSISTION: What about applications? ADDITIONAL INFORMATION FOR PRESENTER:
  17. KEY MESSAGE: Business to Business is a problem SLIDE SCRIPT: SLIDE BUILD: But what if we want to write an application to do exactly the same thing? Today, this is a problem. Applications can’t easily browse the Web. SLIDE TRANSISTION: Let’s see how Web services fit in. ADDITIONAL INFORMATION FOR PRESENTER:
  18. KEY MESSAGE: Business to Business is a problem SLIDE SCRIPT: SLIDE BUILD: But what if we want to write an application to do exactly the same thing? Today, this is a problem. Applications can’t easily browse the Web. SLIDE TRANSISTION: Let’s see how Web services fit in. ADDITIONAL INFORMATION FOR PRESENTER:
  19. KEY MESSAGE: The big picture of Web services SLIDE BUILDS: None SLIDE SCRIPT: Web services allow applications to communicate across the Internet. The programming language that the application is written in doesn’t matter. The platform that the application is running on doesn’t matter. The applications communicate by sending an XML document, conforming to a certain schema. As long as the applications can properly receive and respond with these XML documents, they can communicate. Web services can be written to be synchronous or asynchronous. Because of the added latency of Web services, it may be desirable for them to be stateless, but this requires additional coding complexity. The SOAP protocol supports a model for both stateful and stateless Web services. The typical scenario is stateless, but Web services supports stateful components using session variables. BizTalk is a server product that ships with development tools allowing you to do such things as translate schemas, and orchestrate business processes. BizTalk also supports a number of protocols for passing messages. BizTalk utilizes the SOAP protocol. ASP.NET is a leaner, simpler implementation also built on the SOAP protocol. We’ll focus on Web services using ASP.NET, but know that Web services is a large and loosely defined term. SLIDE TRANSISTION: Let’s see how Web services fit in. ADDITIONAL INFORMATION FOR PRESENTER:
  20. KEY MESSAGE: Starts with a file similar to an ASPX SLIDE SCRIPT: SLIDE BUILD: You create a Web service by writing the implementation for a class… SLIDE BUILD: …and saving it to a Web server with an ASMX extension. SLIDE TRANSISTION: Testing ADDITIONAL INFORMATION FOR PRESENTER:
  21. KEY MESSAGE: Testing a Web service SLIDE SCRIPT: SLIDE BUILD: To test, the class, you simply browse to this page with the asmx extension. SLIDE BUILD: The framework automatically generates an HTML front end to this page. This describes the class, it’s methods, and the arguments to the methods. You can supply test values, and insure the proper operation of the class. SLIDE TRANSISTION: Generating a proxy ADDITIONAL INFORMATION FOR PRESENTER:
  22. KEY MESSAGE: Generating a proxy SLIDE SCRIPT: SLIDE BUILD: To use this class programatically, you will need a proxy DLL on your client. A proxy DLL provides exactly the same interface as the Web service, but it doesn’t contain the functionality. Its only purpose is to communicate with the Web service and return the results. You create a proxy with the WSDL application. SLIDE BUILD: When you request an ASMX with a WSDL as part of the query string, you get an XML document that conforms to the SOAP specification. This describes the interface to the class, and WSDL uses this to build the proxy DLL. SLIDE TRANSISTION: Putting it all together ADDITIONAL INFORMATION FOR PRESENTER:
  23. KEY MESSAGE: Putting it all together SLIDE SCRIPT: SLIDE BUILD: Here’s an example use of a Web service. A user registers for a course on-line. This is nothing new. We could do this previously with ASP. SLIDE BUILD: However, when the user registers for the course, the Web server automatically orders courseware from a vendor. Here’s where Web services comes in. The ASP creates an instance of the proxy class, and makes a method call. “OrderCourseware”, for example. The proxy talks to the actual server implementing the Web service, where the request is passed to the ASMX. The request is processed, and the results are returned. This would be very difficult today with just ASP. SLIDE TRANSISTION: Let’s see this technology in action. ADDITIONAL INFORMATION FOR PRESENTER: