SlideShare a Scribd company logo
Web Server (IIS)


Information Services (IIS) 6.0 is a powerful Web
server that provides a highly reliable, manageable,
and scalable Web application infrastructure for all
versions of Windows
◦
◦
◦
◦
◦
◦
◦

Compatibility with Microsoft and Other Products
Rapid Installation and Configuration
Easy Service Management
Effortless Performance Monitoring
Easy to Implement Security
Foundation for ASP.NET
IIS pass the request from client to application
Web Server
Server Machine
ASP (.Net)
Web server (IIS)

http request

http request

http request

Client
Client
Machine
Machine

Client
Client
Machine
Machine

Client
Client
Machine
Machine
Web Server
Port Nos.

80
(Default Port)

IIS
Web

1525

Server
8899
192.168.0.12
Server IP

http://192.168.0.12/myfoler/WebForm1.aspx
http://192.168.0.12:8899/index.html
ASP .Net

Is the platform that we use to create Web
applications and Web services that run under IIS
 At a high level, ASP.NET is a collection of .NET
classes that collaborate to process an HTTP
request and generate an HTTP response
 It provides high level of consistency across web
applications




We have components like web development tools,
◦ System.web namespace
◦ Server and HTML controls
ASP .Net Frame Work






ASP.NET is a managed server-side framework
◦ For building applications based on HTTP, HTML, XML and SOAP
◦ ASP.NET relies on IIS for an HTTP entry point
ASP.NET supports building HTML-based Web applications
◦ Based on ASP.NET pages, Web forms and server-side controls
ASP.NET supports building Web services
◦ Based on Web service classes and WebMethods

Web Application
client

Web Service
client

HTML over HTTP
IIS

XML/SOAP over HTTP

ASP.NET

CLR
Windows 2000 or Windows .NET Server













Executable portion of a web application are compiled
Enriched tool support
ASP.NET applications are based on CLR, so therefore
they are powerful and flexible.
On the fly updates deployed without restarting server
Better session management
Integration with ADO.NET
Built in features for caching
XML Web services let you create distributed Web
applications
Browser-independent
Language-independent
 ASP.NET

programming model is based
on applications
◦ Each application is based on IIS virtual
directory
◦ Each application is contained within a
physical directory
◦ Each application runs in its own isolated
AppDomain


AssemblyInfo.cs
◦ All the information about assembly including version
company name etc



Webform1.aspx
◦ The visual description of a Web form.



Webform1.aspx.cs/vb
◦ The code that responds to events on the Web form



Global.asax
◦ The global events that occur in web application are here


Web.config

◦


It is a XML file that web server uses when processing this
application

References
◦
◦
◦
◦

System
System.Data
System.Drawing
System.XML


Webform Views
◦ Design view
 The design View represents the user interface.

◦ HTML view.
 Represents ASP.NET syntax for the webpage
System. Object

System.Web.UI

System.Web.UI.Control

System.Web.UI.Web Controls

System.Web.UI.HTMLControls
Component

Examples

Server controls

TextBox
Label
Button
ListBox
DropDownList
DataGrid

HTML controls

Text Area
Table
Image
Submit Button
Reset Button

Data controls

SqlConnection
SqlCommand,
OleDbConnection,
OleDbCommand
DataSet

Description
These controls respond to user events
by running event procedures on the
server. Server controls have built-in
features for saving data that the user
enters between page displays.
These represent the standard visual
elements provided in HTML. HTML
controls are useful when the more
complete feature set provided by
server controls is not needed.
Data controls provide a way to connect
to, perform commands on, and
retrieve data from SQL and OLE
databases and XML data files.


ASP.NET stores items added to a page’s ViewState
property as hidden fields managed by the ASP.NET
page framework.



As soon as form is submitted for processing, all
information relevant to the view state of the page is
stored within this hidden form field.



View state is enabled for every page by default.




Hidden ViewState control of name-value pairs stored in the
Web Form
Adjustable at Web Form and control level
<input type="hidden" name="__VIEWSTATE"
value="dDwtMTA4MzE0MjEwNTs7Pg==" />
<%@ Page EnableViewState="False" %>
<asp:ListBox id="ListName"
EnableViewState="true" runat="server">
</asp:ListBox>
The validation controls check the validity of data
entered in associated server controls on the client
before the page is posted back to the server.
 Supports validation on client and server
 Client-side validation is provided by a JScript
library named WebUIValidation.js
 Can force down-level option


<% @ Page Language="c#"
ClientTarget="DownLevel" %>
Validation control

Description

RequiredFieldValidator

Check whether a control contains data

CompareValidator

Check whether an entered item matches an entry in
another control
Check whether an entered item is between two values

RangeValidator

ValidationSummary

Display validation errors in a central location or display a
general validation error description
Validation control

Description

RegularExpressionValidator

Check whether an entered item matches a
specified format

CustomValidator

Check the validity of an entered item
using a client-side script or a server-side
code, or both
Session State
HTTP is a stateless protocol, which means that it does not automatically indicate whether a sequence of requests is
all from the same client or even whether a single browser instance is still actively viewing a page or site. As a result,
building Web applications that need to maintain some cross-request state information (shopping carts, data scrolling,
and so on) can be extremely challenging without additional infrastructure help.
ASP.NET provides the following support for sessions:
•A session-state facility that is easy to use, familiar to ASP developers, and consistent with other .NET
Framework APIs.
•A reliable session-state facility that can survive Internet Information Services (IIS) restarts and workerprocess restarts without losing session data.
•A scalable session-state facility that can be used in both Web farm (multicomputer) and Web garden
(multiprocess) scenarios and that enables administrators to allocate more processors to a Web application to
improve its scalability.
•A session-state facility that works with browsers that do not support HTTP cookies.
•A throughput equivalent to that of ASP (or better) for core session-state scenarios (50/50 read/write when
putting items into shopping carts, modifying last page visited, validating credit card details, and so on).
Session
Server Machine
ASP.Net Progs.
Create Session
Session Name “XX”
Session Value “cmc”

Client Machine

Client Machine

Client Machine

“XX” Session with “cmc”

“XX” Session with “cmc”

“XX” Session with “cmc”

Session “XX” is available till the browser is open, delete automatically when the browser
is closed
Session

Web page 1
(Creating Session)
(Creating Session)

Session.Add(“session_name", “session_value”)

Web page 2
(Accessing Session)
(Accessing Session)

variable = Session(“session_name")
Session
User Id

Password

stud1

Web Page 2

Login

******

Web Page 1

Login ID

TextBox1

Session.Add(“user_session", TextBox1.Text)

stud1

Label1

Label1.Text=Session.Add(“user_session")
Cookie
•A cookie is a small piece of information stored by the browser at local disk.
• Each cookie is stored in a name =value; pair called a crumb
(that is, if the cookie name is "id" and you want to save the id's value as "this", the cookie would
be saved as id=this)

•In a cookie up to 20 name=value pairs can be stored
•Cookie is always returned as a string of all the cookies that apply to the page.
•It stores information in cookie folder.
•It expires when browser is closed if expired time is not set.
Cookie
Server Machine
ASP.Net Progs.
Create Cookie
Cookie Name “CC”
Cookie Value “edu”

Client Machine

Client Machine

Client Machine

Create “CC” Cookie

Create “CC” Cookie

Create “CC” Cookie

[CC]
edu

[CC]
edu

Local Disk

[CC]
edu
Cookie
TextBox1

Dim MyCookie As New HttpCookie("CMCcookie")
Dim now As DateTime = DateTime.Now
MyCookie.Value = TextBox1.Text

student

MyCookie.Expires = now.AddSeconds(100)

Set Cookie

Response.Cookies.Add(MyCookie)

Dim ck As HttpCookie
ck = Request.Cookies("CMCcookie")
If ck Is Nothing Then
Exit Sub
End If
TextBox1.Text = ck.Name
TextBox2.Text = ck.Value

CMCcookie

TextBox1

student

TextBox2

Show Cookie
Cookie
Dim i, j As Integer
Dim arr1() As String
Dim MyCookieColl As HttpCookieCollection
Dim MyCookie As HttpCookie

Display All Cookies
Display All Cookies
From Local
From Local
Machine
Machine

MyCookieColl = Request.Cookies
' Capture all cookie names into a string array.
arr1 = MyCookieColl.AllKeys
For i = 0 To arr1.GetUpperBound(0)
MyCookie = MyCookieColl(arr1(i))
Response.Write("Cookie: " & MyCookie.Name & "<br>")
Response.Write("Value " & MyCookie.Value & "<br>")
Response.Write("Expires: " & MyCookie.Expires & "<br>")
Response.Write("Secure:" & MyCookie.Secure & "<br>")
Next i
Application
•Application variables are, in effect, global variables for a given ASP.NET application.
•Client-side application developers, ASP.NET programmers should always consider
the impact of storing anything as a global variable.
•Share information throughout the application by using the Application class
•This class exposes a key-value dictionary of objects that you can use to store both
.NET Framework objects and scalar values related to multiple Web requests from
multiple clients.
•The memory impact of storing something in application state. The memory occupied
by variables stored in application state is not released until the value is either removed
or replaced.
Application
Server Machine
ASP.Net Progs.
Create Application
Session Name “My_App”
Session Value “India”

Client Machine
Accessing “My_App”
with value “India”

Client Machine
Accessing “My_App”
with value “India”

Client Machine
Accessing “My_App”
with value “India”
Application
Server Machine
Application(“My_App") = “India”

Client 1
India

Client 2
India

Client 3
India

x=Application(“My_App")

y=Application(“My_App")

z=Application(“My_App")

TextBox1.Text=x

TextBox1.Text=y

TextBox1.Text=z
Caching
•Caching, use to create high-performance Web applications.
•Caching are Output Caching and Data Caching

•Output Caching allows to store dynamic page and user control responses
•On subsequent requests, the page or user control code is not executed.
•The cached output is used to satisfy the request.

•Data Caching can use to programmatically store arbitrary objects, such as data
sets, to server memory so that your application can save the time and resources it
takes to recreate them.
Caching (Output Cache)
<%@ OutputCache Duration="30" VaryByParam="location;count" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="cacheing.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<BODY>
------------------------------------------------------------------------------------------------</BODY>
</HTML>

WebForm1.aspx (Html View)

Response.Write("<font size=6>The Page was executed " & DateTime.Now.ToString + "</font>")
If RadioButton1.Checked = True Then
Label1.Text = "You have selected... Red color"
Else
Label1.Text = "You have selected... Blue color"
End If

WebForm1.aspx.vb
Caching (Data Cache)
Dim flag As Integer
source = Cache("MyDataCache")
If source Is Nothing Then
flag = 100
cmd = New OleDb.OleDbCommand("select * from dept ", conn)
adp = New OleDbDataAdapter(cmd)
ds = New DataSet()
adp.Fill(ds, “deptX")
source = New DataView(ds.Tables("deptX "))
Cache.Insert("MyDataCache", source, New Caching.CacheDependency(Server.MapPath("datacache")),
DateTime.Now.AddSeconds(20), Cache.NoSlidingExpiration)
End If
DataGrid1.DataSource = source
DataGrid1.DataBind()
If flag = 100 Then
Label1.Text = "Data from Database"
Else
Label1.Text = "Data from Cache"
End If

WebForm1.aspx.vb
Ad Rotator Control
•AdRotator control to display a randomly selected advertisement banner on the Web page.
•The displayed advertisement can change whenever the page refreshes.
•Advertisement information is stored in a separate XML file.
•The XML file allows you to maintain a list of advertisements and their associated attributes.
Attributes include the path to an image to display, the URL to link to when the control is
clicked, the alternate text to display when the image in not available, a keyword, and the
frequency of the advertisement.
Ad Rotator Control
Ad Rotator Contro
AdvertisementFile=“Ads.xml”
WebForm1.aspx (Design View)

<Advertisements>

<Ad>

Ads.xm
l

<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wing Tip Toys</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic2</Keyword>
</Ad>
</Advertisements>

Image1.jpg, image2.jpg
and other picture file
should be added to the
current project
Ad Rotator Control
Ad Rotator Contro
AdvertisementFile=“Ads.xml”
WebForm1.aspx (Design View)

<Advertisements>

<Ad>

Ads.xm
l

<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wing Tip Toys</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic2</Keyword>
</Ad>
</Advertisements>

Image1.jpg, image2.jpg
and other picture file
should be added to the
current project
Advanced List Controls

There are some advanced list controls like
Repeater, DataList, and DataGrid
 They take collections of data and loop through them
automatically.
 They act as containers for other controls that
actually display the data such as labels.
 These controls are very powerful and save
developers a lot of manual work.

Repeater Control
Provides simple output of a list of items
 Templates provide the visual form
 It iterates over the bound data, rendering its
ItemTemplate once for each item in the
DataSource collection
 Useful to have complete control over how data
from a data source is rendered
 No paging
 Can provide templates for separators
 Does not provide update data

Repeater Control


Standard templates for Repeater controls

◦ HeaderTemplate: rendered once before all data bound
rows
◦ ItemTemplate: rendered once for each row in the data
source
◦ AlternatingItemTemplate: like ItemTemplate, but when
present is used for every other row
◦ SeparatorTemplate: rendered between each row
◦ FooterTemplate: rendered once, after all data bound rows
Repeater Control
To bind embedded controls to the data source of
the container control DataBinder.Eval() method is
used
 DataBinder.Eval() method is provided by .net to
evaluate expression
 Syntax


◦ <%# DataBinder.Eval(Container.DataItem,“DataFieldname") %>
◦ Container represents the container for data items
◦ DataField represents the name of data item field
DataList Control
Provides list output with editing
 Default look is a table
 Customized via templates
 Directional rendering (horizontal or vertical)
 Alternate item
 Updateable
 No paging

DataGrid Control
Full-featured list output
 Default look is a grid
 Default is to show all columns, though you can
specify a subset of columns to display
 Columns can be formatted with templates
 Optional paging
 Updatable

Tracing


ASP.NET supports tracing

◦ Easy way to include “debug” statements
◦ No more messy Response.Write() calls!



Great way to collect request details
◦
◦
◦
◦



Server control tree
Server variables, headers, cookies
Form/Query string parameters
Tracing provides a wealth of information about the page

Can be enabled at page- or application- level
Tracing






Methods
◦ Trace.Write: Writes category and text to trace
◦ Trace.Warn: Writes category and text to trace in red
Properties
◦ Trace.IsEnabled: True if tracing is turned on for the
application or just that page
◦ Tracemode = "[SortByTime | SortByCategory
Trace.axd
◦ is an Http Handler( An Http Handler is a coding option
that allows us to handle request/responses at the most
basic level).
Tracing
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
Error Handling
.NET Common Language Runtime provides
structured Exception handling using try catch
block.
 ASP.NET provides declarative application
custom error handling


◦ Automatically redirect users to error page when
unhandled exceptions occur
◦ Prevents ugly error messages from being sent to users

<customErrors
/>

mode="RemoteOnly"
Error Handling
Mode attribute is either set into On or
RemoteOnly .
 On

◦ Error messages will be displayed in client
and well as server where application is
running



RemoteOnly

◦ Error messages will be displayed only at
client location
Error Handling
Custom Error Pages
 Can specify error pages for specific HTTP status
codes in web.config


<configuration>
<customerrors mode=“remoteonly”
defaultredirect=“error.htm”>
<error statuscode=“404”
redirect=“adminmessage.htm”/>
<error statuscode=“403”
redirect=“noaccessallowed.htm”/>
</customerrors>
</configuration>
Subhas Malik
Software Developer(R&D Web ERP).
Microsoft SQL Server , C# , Ajax , Jquery , WCF , WPF , Telerik , MVP, MVC.
Kolkata, West Bengal, India.
Subhas Malik writes about a wide range of technology and products, but has a
particular focus on internet technology, browsers, software development (both back
end and font end), cyber security, mobile technology and many others related to
Information Technology. He joined blog/tech forum/developer community since 2009
and has also covered blogger, Microsoft, codeplex, stackoverflow, slideshare, linkedin
, codeproject, c-sharpcorner, youtube, quora, stackexchange, soundcloud, Google,
Yahoo, servers, supercomputing, Linux, other open-source software, and science and
many other tech community.
follow in blogger, wordpress , google+, Facebook, twitter, rediff mypage and itimes.
Thank You!
Ad

More Related Content

What's hot (20)

Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
Rishi Kothari
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
baabtra.com - No. 1 supplier of quality freshers
 
J2EE Introduction
J2EE IntroductionJ2EE Introduction
J2EE Introduction
Patroklos Papapetrou (Pat)
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Rajkumarsoy
 
Web services SOAP
Web services SOAPWeb services SOAP
Web services SOAP
princeirfancivil
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
V.V.Vanniaperumal College for Women
 
Soap vs rest
Soap vs restSoap vs rest
Soap vs rest
Antonio Severien
 
Web api
Web apiWeb api
Web api
Sudhakar Sharma
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
Lanh Le
 
jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects  jQuery - Chapter 3 - Effects
jQuery - Chapter 3 - Effects
WebStackAcademy
 
Web service Introduction
Web service IntroductionWeb service Introduction
Web service Introduction
Madhukar Kumar
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
Edureka!
 
Ajax
AjaxAjax
Ajax
Tech_MX
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
Shashwat Shriparv
 
Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC)
Pooja Talreja
 
Cookies & Session
Cookies & SessionCookies & Session
Cookies & Session
university of education,Lahore
 
Android Fragment
Android FragmentAndroid Fragment
Android Fragment
Kan-Han (John) Lu
 
Introduction to asp.net
Introduction to asp.netIntroduction to asp.net
Introduction to asp.net
shan km
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
ecosio GmbH
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
Jesus Perez Franco
 

Viewers also liked (20)

ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1ASP.NET Tutorial - Presentation 1
ASP.NET Tutorial - Presentation 1
Kumar S
 
Four image slide
Four image slideFour image slide
Four image slide
Mianlside
 
c# training in bangalore | asp.net with c# training | vb.net code projects,as...
c# training in bangalore | asp.net with c# training | vb.net code projects,as...c# training in bangalore | asp.net with c# training | vb.net code projects,as...
c# training in bangalore | asp.net with c# training | vb.net code projects,as...
shashinm
 
Asp.net caching
Asp.net cachingAsp.net caching
Asp.net caching
Mindfire Solutions
 
ASP.net Image Slideshow
ASP.net Image SlideshowASP.net Image Slideshow
ASP.net Image Slideshow
Hock Leng PUAH
 
Aspnet Caching
Aspnet CachingAspnet Caching
Aspnet Caching
rainynovember12
 
Web Server Administration
Web Server AdministrationWeb Server Administration
Web Server Administration
webhostingguy
 
Ch 04 asp.net application
Ch 04 asp.net application Ch 04 asp.net application
Ch 04 asp.net application
Madhuri Kavade
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
Madhuri Kavade
 
Vb.net session 05
Vb.net session 05Vb.net session 05
Vb.net session 05
Niit Care
 
Cloud Computing Fundamentals
Cloud Computing FundamentalsCloud Computing Fundamentals
Cloud Computing Fundamentals
Sonia Nagpal
 
Introduction to asp
Introduction to aspIntroduction to asp
Introduction to asp
Madhuri Kavade
 
INPUT BOX- VBA
INPUT BOX- VBAINPUT BOX- VBA
INPUT BOX- VBA
ViVek Patel
 
State management in ASP .NET
State  management in ASP .NETState  management in ASP .NET
State management in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
rahuld115
 
Asp dot net final (2)
Asp dot net   final (2)Asp dot net   final (2)
Asp dot net final (2)
Amelina Ahmeti
 
Debugging
DebuggingDebugging
Debugging
nicky_walters
 
Controls in asp.net
Controls in asp.netControls in asp.net
Controls in asp.net
baabtra.com - No. 1 supplier of quality freshers
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
Nitu Pandey
 
Asp.net server controls
Asp.net server controlsAsp.net server controls
Asp.net server controls
Raed Aldahdooh
 
Ad

Similar to The complete ASP.NET (IIS) Tutorial with code example in power point slide show (20)

ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
ASP.NET Lecture 2
ASP.NET Lecture 2ASP.NET Lecture 2
ASP.NET Lecture 2
Julie Iskander
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
Akhil Mittal
 
Walther Ajax4
Walther Ajax4Walther Ajax4
Walther Ajax4
rsnarayanan
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security development
Synapseindiappsdevelopment
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
Jignesh Aakoliya
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
actacademy
 
Active server pages
Active server pagesActive server pages
Active server pages
mcatahir947
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
Vivek Singh Chandel
 
Aspnet architecture
Aspnet architectureAspnet architecture
Aspnet architecture
phantrithuc
 
05 asp.net session07
05 asp.net session0705 asp.net session07
05 asp.net session07
Vivek Singh Chandel
 
Programming web application
Programming web applicationProgramming web application
Programming web application
aspnet123
 
Asp PPT (.NET )
Asp PPT (.NET )Asp PPT (.NET )
Asp PPT (.NET )
Ankit Gupta
 
Asp dot net long
Asp dot net longAsp dot net long
Asp dot net long
Amelina Ahmeti
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 
SynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax DevelopmentSynapseIndia asp.net2.0 ajax Development
SynapseIndia asp.net2.0 ajax Development
Synapseindiappsdevelopment
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applications
Deepankar Pathak
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
Caleb Jenkins
 
Introductionto asp net-ppt
Introductionto asp net-pptIntroductionto asp net-ppt
Introductionto asp net-ppt
tmasyam
 
ASP.Net Presentation Part1
ASP.Net Presentation Part1ASP.Net Presentation Part1
ASP.Net Presentation Part1
Neeraj Mathur
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
Akhil Mittal
 
SynapseIndia dotnet website security development
SynapseIndia  dotnet website security developmentSynapseIndia  dotnet website security development
SynapseIndia dotnet website security development
Synapseindiappsdevelopment
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
Jignesh Aakoliya
 
Active server pages
Active server pagesActive server pages
Active server pages
mcatahir947
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
Chui-Wen Chiu
 
Aspnet architecture
Aspnet architectureAspnet architecture
Aspnet architecture
phantrithuc
 
Programming web application
Programming web applicationProgramming web application
Programming web application
aspnet123
 
Asp interview Question and Answer
Asp interview Question and Answer Asp interview Question and Answer
Asp interview Question and Answer
home
 
How to develop asp web applications
How to develop asp web applicationsHow to develop asp web applications
How to develop asp web applications
Deepankar Pathak
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
Caleb Jenkins
 
Introductionto asp net-ppt
Introductionto asp net-pptIntroductionto asp net-ppt
Introductionto asp net-ppt
tmasyam
 
Ad

Recently uploaded (20)

Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 

The complete ASP.NET (IIS) Tutorial with code example in power point slide show

  • 1. Web Server (IIS)  Information Services (IIS) 6.0 is a powerful Web server that provides a highly reliable, manageable, and scalable Web application infrastructure for all versions of Windows ◦ ◦ ◦ ◦ ◦ ◦ ◦ Compatibility with Microsoft and Other Products Rapid Installation and Configuration Easy Service Management Effortless Performance Monitoring Easy to Implement Security Foundation for ASP.NET IIS pass the request from client to application
  • 2. Web Server Server Machine ASP (.Net) Web server (IIS) http request http request http request Client Client Machine Machine Client Client Machine Machine Client Client Machine Machine
  • 3. Web Server Port Nos. 80 (Default Port) IIS Web 1525 Server 8899 192.168.0.12 Server IP http://192.168.0.12/myfoler/WebForm1.aspx http://192.168.0.12:8899/index.html
  • 4. ASP .Net Is the platform that we use to create Web applications and Web services that run under IIS  At a high level, ASP.NET is a collection of .NET classes that collaborate to process an HTTP request and generate an HTTP response  It provides high level of consistency across web applications   We have components like web development tools, ◦ System.web namespace ◦ Server and HTML controls
  • 5. ASP .Net Frame Work    ASP.NET is a managed server-side framework ◦ For building applications based on HTTP, HTML, XML and SOAP ◦ ASP.NET relies on IIS for an HTTP entry point ASP.NET supports building HTML-based Web applications ◦ Based on ASP.NET pages, Web forms and server-side controls ASP.NET supports building Web services ◦ Based on Web service classes and WebMethods Web Application client Web Service client HTML over HTTP IIS XML/SOAP over HTTP ASP.NET CLR Windows 2000 or Windows .NET Server
  • 6.           Executable portion of a web application are compiled Enriched tool support ASP.NET applications are based on CLR, so therefore they are powerful and flexible. On the fly updates deployed without restarting server Better session management Integration with ADO.NET Built in features for caching XML Web services let you create distributed Web applications Browser-independent Language-independent
  • 7.  ASP.NET programming model is based on applications ◦ Each application is based on IIS virtual directory ◦ Each application is contained within a physical directory ◦ Each application runs in its own isolated AppDomain
  • 8.  AssemblyInfo.cs ◦ All the information about assembly including version company name etc  Webform1.aspx ◦ The visual description of a Web form.  Webform1.aspx.cs/vb ◦ The code that responds to events on the Web form  Global.asax ◦ The global events that occur in web application are here
  • 9.  Web.config ◦  It is a XML file that web server uses when processing this application References ◦ ◦ ◦ ◦ System System.Data System.Drawing System.XML
  • 10.  Webform Views ◦ Design view  The design View represents the user interface. ◦ HTML view.  Represents ASP.NET syntax for the webpage
  • 12. Component Examples Server controls TextBox Label Button ListBox DropDownList DataGrid HTML controls Text Area Table Image Submit Button Reset Button Data controls SqlConnection SqlCommand, OleDbConnection, OleDbCommand DataSet Description These controls respond to user events by running event procedures on the server. Server controls have built-in features for saving data that the user enters between page displays. These represent the standard visual elements provided in HTML. HTML controls are useful when the more complete feature set provided by server controls is not needed. Data controls provide a way to connect to, perform commands on, and retrieve data from SQL and OLE databases and XML data files.
  • 13.  ASP.NET stores items added to a page’s ViewState property as hidden fields managed by the ASP.NET page framework.  As soon as form is submitted for processing, all information relevant to the view state of the page is stored within this hidden form field.  View state is enabled for every page by default.
  • 14.   Hidden ViewState control of name-value pairs stored in the Web Form Adjustable at Web Form and control level <input type="hidden" name="__VIEWSTATE" value="dDwtMTA4MzE0MjEwNTs7Pg==" /> <%@ Page EnableViewState="False" %> <asp:ListBox id="ListName" EnableViewState="true" runat="server"> </asp:ListBox>
  • 15. The validation controls check the validity of data entered in associated server controls on the client before the page is posted back to the server.  Supports validation on client and server  Client-side validation is provided by a JScript library named WebUIValidation.js  Can force down-level option  <% @ Page Language="c#" ClientTarget="DownLevel" %>
  • 16. Validation control Description RequiredFieldValidator Check whether a control contains data CompareValidator Check whether an entered item matches an entry in another control Check whether an entered item is between two values RangeValidator ValidationSummary Display validation errors in a central location or display a general validation error description
  • 17. Validation control Description RegularExpressionValidator Check whether an entered item matches a specified format CustomValidator Check the validity of an entered item using a client-side script or a server-side code, or both
  • 18. Session State HTTP is a stateless protocol, which means that it does not automatically indicate whether a sequence of requests is all from the same client or even whether a single browser instance is still actively viewing a page or site. As a result, building Web applications that need to maintain some cross-request state information (shopping carts, data scrolling, and so on) can be extremely challenging without additional infrastructure help. ASP.NET provides the following support for sessions: •A session-state facility that is easy to use, familiar to ASP developers, and consistent with other .NET Framework APIs. •A reliable session-state facility that can survive Internet Information Services (IIS) restarts and workerprocess restarts without losing session data. •A scalable session-state facility that can be used in both Web farm (multicomputer) and Web garden (multiprocess) scenarios and that enables administrators to allocate more processors to a Web application to improve its scalability. •A session-state facility that works with browsers that do not support HTTP cookies. •A throughput equivalent to that of ASP (or better) for core session-state scenarios (50/50 read/write when putting items into shopping carts, modifying last page visited, validating credit card details, and so on).
  • 19. Session Server Machine ASP.Net Progs. Create Session Session Name “XX” Session Value “cmc” Client Machine Client Machine Client Machine “XX” Session with “cmc” “XX” Session with “cmc” “XX” Session with “cmc” Session “XX” is available till the browser is open, delete automatically when the browser is closed
  • 20. Session Web page 1 (Creating Session) (Creating Session) Session.Add(“session_name", “session_value”) Web page 2 (Accessing Session) (Accessing Session) variable = Session(“session_name")
  • 21. Session User Id Password stud1 Web Page 2 Login ****** Web Page 1 Login ID TextBox1 Session.Add(“user_session", TextBox1.Text) stud1 Label1 Label1.Text=Session.Add(“user_session")
  • 22. Cookie •A cookie is a small piece of information stored by the browser at local disk. • Each cookie is stored in a name =value; pair called a crumb (that is, if the cookie name is "id" and you want to save the id's value as "this", the cookie would be saved as id=this) •In a cookie up to 20 name=value pairs can be stored •Cookie is always returned as a string of all the cookies that apply to the page. •It stores information in cookie folder. •It expires when browser is closed if expired time is not set.
  • 23. Cookie Server Machine ASP.Net Progs. Create Cookie Cookie Name “CC” Cookie Value “edu” Client Machine Client Machine Client Machine Create “CC” Cookie Create “CC” Cookie Create “CC” Cookie [CC] edu [CC] edu Local Disk [CC] edu
  • 24. Cookie TextBox1 Dim MyCookie As New HttpCookie("CMCcookie") Dim now As DateTime = DateTime.Now MyCookie.Value = TextBox1.Text student MyCookie.Expires = now.AddSeconds(100) Set Cookie Response.Cookies.Add(MyCookie) Dim ck As HttpCookie ck = Request.Cookies("CMCcookie") If ck Is Nothing Then Exit Sub End If TextBox1.Text = ck.Name TextBox2.Text = ck.Value CMCcookie TextBox1 student TextBox2 Show Cookie
  • 25. Cookie Dim i, j As Integer Dim arr1() As String Dim MyCookieColl As HttpCookieCollection Dim MyCookie As HttpCookie Display All Cookies Display All Cookies From Local From Local Machine Machine MyCookieColl = Request.Cookies ' Capture all cookie names into a string array. arr1 = MyCookieColl.AllKeys For i = 0 To arr1.GetUpperBound(0) MyCookie = MyCookieColl(arr1(i)) Response.Write("Cookie: " & MyCookie.Name & "<br>") Response.Write("Value " & MyCookie.Value & "<br>") Response.Write("Expires: " & MyCookie.Expires & "<br>") Response.Write("Secure:" & MyCookie.Secure & "<br>") Next i
  • 26. Application •Application variables are, in effect, global variables for a given ASP.NET application. •Client-side application developers, ASP.NET programmers should always consider the impact of storing anything as a global variable. •Share information throughout the application by using the Application class •This class exposes a key-value dictionary of objects that you can use to store both .NET Framework objects and scalar values related to multiple Web requests from multiple clients. •The memory impact of storing something in application state. The memory occupied by variables stored in application state is not released until the value is either removed or replaced.
  • 27. Application Server Machine ASP.Net Progs. Create Application Session Name “My_App” Session Value “India” Client Machine Accessing “My_App” with value “India” Client Machine Accessing “My_App” with value “India” Client Machine Accessing “My_App” with value “India”
  • 28. Application Server Machine Application(“My_App") = “India” Client 1 India Client 2 India Client 3 India x=Application(“My_App") y=Application(“My_App") z=Application(“My_App") TextBox1.Text=x TextBox1.Text=y TextBox1.Text=z
  • 29. Caching •Caching, use to create high-performance Web applications. •Caching are Output Caching and Data Caching •Output Caching allows to store dynamic page and user control responses •On subsequent requests, the page or user control code is not executed. •The cached output is used to satisfy the request. •Data Caching can use to programmatically store arbitrary objects, such as data sets, to server memory so that your application can save the time and resources it takes to recreate them.
  • 30. Caching (Output Cache) <%@ OutputCache Duration="30" VaryByParam="location;count" %> <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="cacheing.WebForm1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <BODY> ------------------------------------------------------------------------------------------------</BODY> </HTML> WebForm1.aspx (Html View) Response.Write("<font size=6>The Page was executed " & DateTime.Now.ToString + "</font>") If RadioButton1.Checked = True Then Label1.Text = "You have selected... Red color" Else Label1.Text = "You have selected... Blue color" End If WebForm1.aspx.vb
  • 31. Caching (Data Cache) Dim flag As Integer source = Cache("MyDataCache") If source Is Nothing Then flag = 100 cmd = New OleDb.OleDbCommand("select * from dept ", conn) adp = New OleDbDataAdapter(cmd) ds = New DataSet() adp.Fill(ds, “deptX") source = New DataView(ds.Tables("deptX ")) Cache.Insert("MyDataCache", source, New Caching.CacheDependency(Server.MapPath("datacache")), DateTime.Now.AddSeconds(20), Cache.NoSlidingExpiration) End If DataGrid1.DataSource = source DataGrid1.DataBind() If flag = 100 Then Label1.Text = "Data from Database" Else Label1.Text = "Data from Cache" End If WebForm1.aspx.vb
  • 32. Ad Rotator Control •AdRotator control to display a randomly selected advertisement banner on the Web page. •The displayed advertisement can change whenever the page refreshes. •Advertisement information is stored in a separate XML file. •The XML file allows you to maintain a list of advertisements and their associated attributes. Attributes include the path to an image to display, the URL to link to when the control is clicked, the alternate text to display when the image in not available, a keyword, and the frequency of the advertisement.
  • 33. Ad Rotator Control Ad Rotator Contro AdvertisementFile=“Ads.xml” WebForm1.aspx (Design View) <Advertisements> <Ad> Ads.xm l <ImageUrl>image1.jpg</ImageUrl> <NavigateUrl>http://www.microsoft.com</NavigateUrl> <AlternateText>Microsoft Main Site</AlternateText> <Impressions>80</Impressions> <Keyword>Topic1</Keyword> </Ad> <Ad> <ImageUrl>image2.jpg</ImageUrl> <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl> <AlternateText>Wing Tip Toys</AlternateText> <Impressions>80</Impressions> <Keyword>Topic2</Keyword> </Ad> </Advertisements> Image1.jpg, image2.jpg and other picture file should be added to the current project
  • 34. Ad Rotator Control Ad Rotator Contro AdvertisementFile=“Ads.xml” WebForm1.aspx (Design View) <Advertisements> <Ad> Ads.xm l <ImageUrl>image1.jpg</ImageUrl> <NavigateUrl>http://www.microsoft.com</NavigateUrl> <AlternateText>Microsoft Main Site</AlternateText> <Impressions>80</Impressions> <Keyword>Topic1</Keyword> </Ad> <Ad> <ImageUrl>image2.jpg</ImageUrl> <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl> <AlternateText>Wing Tip Toys</AlternateText> <Impressions>80</Impressions> <Keyword>Topic2</Keyword> </Ad> </Advertisements> Image1.jpg, image2.jpg and other picture file should be added to the current project
  • 35. Advanced List Controls There are some advanced list controls like Repeater, DataList, and DataGrid  They take collections of data and loop through them automatically.  They act as containers for other controls that actually display the data such as labels.  These controls are very powerful and save developers a lot of manual work. 
  • 36. Repeater Control Provides simple output of a list of items  Templates provide the visual form  It iterates over the bound data, rendering its ItemTemplate once for each item in the DataSource collection  Useful to have complete control over how data from a data source is rendered  No paging  Can provide templates for separators  Does not provide update data 
  • 37. Repeater Control  Standard templates for Repeater controls ◦ HeaderTemplate: rendered once before all data bound rows ◦ ItemTemplate: rendered once for each row in the data source ◦ AlternatingItemTemplate: like ItemTemplate, but when present is used for every other row ◦ SeparatorTemplate: rendered between each row ◦ FooterTemplate: rendered once, after all data bound rows
  • 38. Repeater Control To bind embedded controls to the data source of the container control DataBinder.Eval() method is used  DataBinder.Eval() method is provided by .net to evaluate expression  Syntax  ◦ <%# DataBinder.Eval(Container.DataItem,“DataFieldname") %> ◦ Container represents the container for data items ◦ DataField represents the name of data item field
  • 39. DataList Control Provides list output with editing  Default look is a table  Customized via templates  Directional rendering (horizontal or vertical)  Alternate item  Updateable  No paging 
  • 40. DataGrid Control Full-featured list output  Default look is a grid  Default is to show all columns, though you can specify a subset of columns to display  Columns can be formatted with templates  Optional paging  Updatable 
  • 41. Tracing  ASP.NET supports tracing ◦ Easy way to include “debug” statements ◦ No more messy Response.Write() calls!  Great way to collect request details ◦ ◦ ◦ ◦  Server control tree Server variables, headers, cookies Form/Query string parameters Tracing provides a wealth of information about the page Can be enabled at page- or application- level
  • 42. Tracing    Methods ◦ Trace.Write: Writes category and text to trace ◦ Trace.Warn: Writes category and text to trace in red Properties ◦ Trace.IsEnabled: True if tracing is turned on for the application or just that page ◦ Tracemode = "[SortByTime | SortByCategory Trace.axd ◦ is an Http Handler( An Http Handler is a coding option that allows us to handle request/responses at the most basic level).
  • 44. Error Handling .NET Common Language Runtime provides structured Exception handling using try catch block.  ASP.NET provides declarative application custom error handling  ◦ Automatically redirect users to error page when unhandled exceptions occur ◦ Prevents ugly error messages from being sent to users <customErrors /> mode="RemoteOnly"
  • 45. Error Handling Mode attribute is either set into On or RemoteOnly .  On ◦ Error messages will be displayed in client and well as server where application is running  RemoteOnly ◦ Error messages will be displayed only at client location
  • 46. Error Handling Custom Error Pages  Can specify error pages for specific HTTP status codes in web.config  <configuration> <customerrors mode=“remoteonly” defaultredirect=“error.htm”> <error statuscode=“404” redirect=“adminmessage.htm”/> <error statuscode=“403” redirect=“noaccessallowed.htm”/> </customerrors> </configuration>
  • 47. Subhas Malik Software Developer(R&D Web ERP). Microsoft SQL Server , C# , Ajax , Jquery , WCF , WPF , Telerik , MVP, MVC. Kolkata, West Bengal, India. Subhas Malik writes about a wide range of technology and products, but has a particular focus on internet technology, browsers, software development (both back end and font end), cyber security, mobile technology and many others related to Information Technology. He joined blog/tech forum/developer community since 2009 and has also covered blogger, Microsoft, codeplex, stackoverflow, slideshare, linkedin , codeproject, c-sharpcorner, youtube, quora, stackexchange, soundcloud, Google, Yahoo, servers, supercomputing, Linux, other open-source software, and science and many other tech community. follow in blogger, wordpress , google+, Facebook, twitter, rediff mypage and itimes.

Editor's Notes

  • #2: Internet Information Services (IIS) 6.0 is a powerful Web server that provides a highly reliable, manageable, and scalable Web application infrastructure for all versions of Windows Server 2003. IIS helps organizations increase Web site and application availability. No Cost to Acquire One of the best things about Internet Information Server-at the time of this writing-is that it is free. You can easily download it using your web browser from the Microsoft. Compatible with Microsoft and Other Products Internet Information Server runs only on Microsoft Windows Server. However, it is part of an integrated growing product family known as Microsoft BackOffice. This group includes Microsoft SQL Server, Microsoft Exchange Server, Systems Management Server, and SNA Server. IIS works with all client PC browsers on any platform. Rapid Installation and Configuration immediately publish existing files from server or other servers, and in no time, can have own Web site up and running. Easy Service Management An IIS feature known as the Internet Service Manager graphically displays all management options in a graphical menu. Performance Monitoring is easy You can use the Performance Monitor feature to measure system performance. IIS also logs site management and performance information for you for further analysis. Easy to Implement Security IIS uses Windows NT Server directory services to establish secure areas of your Web site. That means you have the ability to require user identification and passwords before a user can access a specified area of your server. You can control access by anonymous users, set document permissions, and audit document access easily with IIS. Additionally, a secure socket layer encrypts conversations between IIS and client browsers that support SSL.
  • #5: ASP.NET is the platform that we use to create Web applications and Web services that run under IIS. ASP.NET provides a high level of consistency across Web application development. In a way, this consistency is similar to the level of consistency that Microsoft Office brought to desktop applications. ASP.NET is part of the .NET Framework and is made up of several components. Visual Studio .NET Web development tools. These include visual tools for designing Web pages and application templates, project management, and deployment tools for Web applications.The System.Web namespaces, are part of the .NET Framework and include the programming classes that deal with Web-specific items such as HTTP requests and responses, browsers, and e-mail.
  • #7: ASP.NET is a revolutionary programming framework that enables the rapid development of powerful web applications and services. It is a part of the Microsoft .NET Platform, provides the easiest and most scalable way to build, deploy and run web applications that can target any browser or device. ASP.NET is a free download for all Windows 2000 and Windows XP systems. The primary design goal of ASP.NET was to Remove Dependency on Script Engines enabling pages to be type safe and compiled and also reduce no of lines of code. ASP.NET is compiled common language runtime code running on the server. All ASP.NET code, including scripts, is compiled, which allows for strong typing, performance optimizations, and early binding, among other benefits. Code once compiled, the CLR further compiles it to native code, providing dramatically improved performance. Since ASP.NET is based on the common language runtime, the benefits of entire platform are available to Web application developers such as power and flexibility of the Framework classes. ASP.NET is Language independent implying that you can code using any .NET Language and also interoperable between different .NET Languages. Configuration information is stored as plain text in XML format. ASP.NET Framework application is deployed to a server simply by XCOPY method that is just copying the necessary files to the server. Server restart is not required, even to deploy or replace an existing compiled code running on the server. ASP.NET applications can be run in a clustered or multiprocessor environment ensuring scalability. ASP.NET was built with the knowledge that IIS needs to be restarted. You can create a new process for a particular application programmatically based on either the number of requests or on the time duration thus ensuring that the application is available through out. Earlier Version of ASP used to be directly intepreted by the ASP engine which was a part of IIS. In case of ASP.NET, it calls the aspwp_exe (ASP.NET Worker Process) which in turn calls the CLR’s appropriate classes.
  • #9: AssemblyInfo.cs All of the attributes that are written into the compiled assembly, including version, company name, GUID, and so on. Global.asax The global events that occur in your Web application, such as when the application starts or ends. You can have only one Global.asax file per project, and it exists in the root folder of the project. Global.asax.cs The code used in Global.asax. This file is not shown in Solution Explorer. Styles.css The style definitions to use for the HTML generated by your project. This file appears only in Visual Basic .NET projects. For Visual C# projects, you can add it manually. Web.config The settings your Web server uses when processing this project. These settings specify how errors are reported, what type of user authentication to use, and so on.
  • #12: Every ASP.NET Page is constituted by a collection of controls – System.Web.UI.Page is itself the top-level control – System.Web.UI.HTMLControls define server-side equivalents of HTML elements – System.Web.UI.WebControls define server-side controls that generate HTML in an intuitive, standard way –– System.Web.UI.Control is the base class for all of these controls, and can be extended to build custom controls
  • #13: You use the server and HTML controls to create the user interface on a Web form. The data controls and system components appear on the Web form only at design time to provide a visual way for you to set their properties and handle their events. At run-time, data controls and system components do not have a visual representation. HtmlControls HtmlControls are server-side representations of standard HTML elements Any HTML element in an ASPX page marked with the runat=server attribute will become an HTML control on the server All derived from HtmlControl class WebControls Provide a more consistent object model and a higher level of abstraction than HtmlControls Provide higher-level controls with more functionality than primitive HTML elements Provide controls for validation,databinding etc
  • #14: The Web is stateless, and so are ASP.NET Pages. They are instantiated, executed, rendered, and disposed on every round trip to the server. ASP.NET stores items added to a page’s ViewState property as hidden fields managed by the ASP.NET page framework. As soon as you submit the form for processing, all information relevant to the view state of the page is stored within this hidden form field. When ASP.NET executes a page, the ViewState values from the page and all of the controls are collected and formatted into a single encoded string, and then assigned to the value attribute of the hidden form field (specifically, &lt;input type=hidden&gt;). Since the hidden form field is part of the page sent to the client, the ViewState value is temporarily stored in the client&apos;s browser.
  • #16: Client-side Validation – Reduces round-trips to the server by correcting mistakes before submitting them – Provides user with immediate feedback on data input – Requires client browser support scripting – Can be easily subverted to send bad data to the server anyway (should never use client-side validation without server-side validation too) Server-side Validation   • Data validation should always occur on the server – Before data is actually used on the server, it should typically be validated – Even with client-side validation, validation on the server should still occur as a precaution – If an error is encountered, the form should be presented to the user again for corrections
  • #37: Repeater The Repeater control is a very generic shell defined almost entirely by its templates There are templates like Header Template,ItemTemplate,Alternating Template,Footer Template etc – It iterates over the bound data, rendering its ItemTemplate once for each item in the DataSource collection – Useful when you want complete control over how data from a data source is rendered
  • #38: The DataGrid, Repeater, and DataList controls provide complete appearance customization through templates Provide a shell for displaying data Let you specify exactly how that data should be displayed using a template
  • #40: DataList The DataList control displays data items in a repeating list The DataList is useful for laying out data items in a list-like format (default rendering is a table with rows and columns) Similar functionality achievable using DataGrid but DataList is simpler to work with Requires that you define at least an ItemTemplate describing how to render each item Each template has its own style (like HeaderStyle and ItemStyle)
  • #41: DataGrid The DataGrid provides a spreadsheet-like display of data from a query Consists of a collection of columns, a header, and a footer Columns can be auto-generated from the underlying query or you can explicitly declare your own BoundColumns Extensively customizable appearance properties available DataGrid Editing The DataGrid provides a special EditCommandColumn designed for editing data DataGrid maintains an EditItemIndex property that indicates which row of the grid should be editable (-1 indicates no row is being edited) The EditCommandColumn renders links for firing three events: EditCommand, UpdateCommand, CancelCommand DataGridCommandEventArgs is passed into each handler, which contains information on the row being edited DataGrid also maintains a DataKeyField property which should be set to the primary key In the event handler for the UpdateCommand, you access the DataKeys collection of the DataGrid to populate the primary key value
  • #42: Tracing with ASP.NET The new tracing features of ASP.NET allow us use new tracing methods.The Trace object is now an intrinsic page object, similar to Request, Response, Server, etc. It is accessible directly with our page code. Trace class Trace is exposed as a public property within ASP.NET pages. When we use the Trace property, we&apos;re working with an instance of the TraceContext class defined in the System.Web namespace.The Trace class exposes two overloaded methods and two properties. The two methods, Warn() and Write(), both support two identical prototypes. Trace.Write: Writes category and text to trace Trace.Warn: Writes category and text to trace in red There are four attributes for the trace element: enabled = &quot;[true/false]&quot;—We can set the enabled option to true or false. Tracing is either enabled at an application level, or it is disabled at the application level. If we set enabled=false, page tracing is still supported using the Trace directive discussed earlier. requestlimit = &quot;[int]&quot;—The total number of trace requests to keep cached in memory on a per-application basis. Tracing exposes a special resource—Trace.axd, which we&apos;ll look at momentarily—that is used to view trace output when pageoutput is set to false. pageoutput = &quot;[true/false]&quot;—When tracing is enabled through the configuration file, the administrator can either enable or disable tracing on each page. The pageoutput tracing enables tracing details for every page within an application. However, pageoutput tracing may be turned off while application-level tracing is still enabled (enabled = &quot;true&quot;). This keeps trace requests in memory, such that they are available via trace.axd, which we&apos;ll look at momentarily, but not displayed within the output of a page. tracemode = &quot;[SortByTime | SortByCategory]&quot;—The tracemode setting gives us control over how trace detail information is output. Data may be sorted by time or category, where category is differentiated between the settings made by the system and the Trace.Write() settings enabled by the developer.