Prepaired by: Sujit Jhare Lecturer Barkatullah University,
-
Upload
rupammajumdar85 -
Category
Documents
-
view
220 -
download
0
Transcript of Prepaired by: Sujit Jhare Lecturer Barkatullah University,
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
1/34
Prepaired By: Sujit Jhare
Lecturer Barkatullah University, Bhopal
Version of HTML
HTML 0 through 1.0These were formallly specified in the Jun 15 1995 HTML, HTML 1.0 was the first release of
HTML to the world
HTML 2.0This is earlier & latest version of HTML This was introduced in 1995, it was the standard
for website design until January 1997 and defined many core HTML features for the first time.
This had most of the elements we know but was missing some of the Netscape/Microsoft
extensions, and did not support tables, or ALIGN attributes.
HTML 3 (late 1995)
This Version of HTML developed by Dave Raggett to upgrade the features and utility of
HTML. However, it was never completed or implemented, although many features wereintegrated in the next "official" version of HTML, known as HTML 3.2
HTML 3.2 (wilbur)This is known as most official version of HTML, integrating support for TABLES,
image, heading and other element ALIGN attributes, HTML 3.2 is the current "universal" dialect
-- essentially all browsers understand HTML 3.2.
However this version of HTML missing some of the Netscape/Microsoft extensions, such as
FRAMEs, EMBED and APPLET. Support for these (after a fashion) came in HTML 4.0
HTML 4.01
HTML 4.01 is the current official standard. It includes support for most of the proprietary
extensions, plus support for extra features (Internationalized documents, support for CascadingStyle Sheets, extra TABLE, FORM, and JavaScript enhancements)
HTML 4.01 is the last version of HTML. For the future, HTML is being replaced by a new
language, calledXHTML -- for the eXtensible HyperText Markup Language
XHTML (1.1)
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
2/34
HTML Frames
HTML frames allow authors to present documents in multiple views, which may be independent windows or
subwindows. Multiple views offer designers a way to keep certain information visible, while other views arescrolled or replaced. For example, within the same window, one frame might display a static banner, a second a
navigation menu, and a third the main document that can be scrolled through or replaced by navigating in the
second frame
A simple frameset document
This frameset document contains:
Some neat contents
Some other neat contents
that might create a frame layout something like this:
---------------------------------------
| | |
| | |
| Frame 1 | |
| | |
| | |
|---------| |
| | Frame 3 |
| | |
| | |
| | |
| Frame 2 | |
| | |
| | |
| | |
| | |
---------------------------------------
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
3/34
Rows and columns
Setting the rows attribute defines the number of horizontal subspaces in a frameset. Setting the
cols attribute defines the number of vertical subspaces. Both attributes may be set
simultaneously to create a grid.
If the rows attribute is not set, each column extends the entire length of the page. If the cols
attribute is not set, each row extends the entire width of the page. If neither attribute is set, the
frame takes up exactly the size of the page.
Frames are created left-to-right for columns and top-to-bottom for rows. When both attributes are
specified, views are created left-to-right in the top row, left-to-right in the second row, etc.
The first example divides the screen vertically in two (i.e., creates a top half and a bottom half).
...the rest of the definition...
The next example creates three columns: the second has a fixed width of 250 pixels (useful, forexample, to hold an image with a known size). The first receives 25% of the remaining space and
the third 75% of the remaining space.
...the rest of the definition...
The next example creates a 2x3 grid of subspaces.
...the rest of the definition...
For the next example, suppose the browser window is currently 1000 pixels high. The first view
is allotted 30% of the total height (300 pixels). The second view is specified to be exactly 400
pixels high. This leaves 300 pixels to be divided between the other two frames. The fourth
frame's height is specified as "2*", so it is twice as high as the third frame, whose height is only
"*" (equivalent to 1*). Therefore the third frame will be 100 pixels high and the fourth will be200 pixels high.
...the rest of the definition...
Absolute lengths that do not sum to 100% of the real available space should be adjusted by the
user agent. When underspecified, remaining space should be allotted proportionally to each
view. When overspecified, each view should be reduced according to its specified proportion of
the total space.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
4/34
The FRAME element
%coreattrs; -- id, class, style, title --
longdesc %URI; #IMPLIED -- link to long description
(complements title) --
name CDATA #IMPLIED -- name of frame for targetting --
src %URI; #IMPLIED -- source of frame content --
frameborder (1|0) 1 -- request frame borders? --
marginwidth%Pixels; #IMPLIED -- margin widths in pixels --
marginheight%Pixels; #IMPLIED -- margin height in pixels --
noresize (noresize) #IMPLIED -- allow users to resize frames? --
scrolling (yes|no|auto) auto -- scrollbar or none --
>]]>
Inline frames: the IFRAME element
%coreattrs; -- id, class, style, title --
longdesc %URI; #IMPLIED -- link to long description
(complements title) --
name CDATA #IMPLIED -- name of frame for targetting --
src %URI; #IMPLIED -- source of frame content --frameborder (1|0) 1 -- request frame borders? --
marginwidth%Pixels; #IMPLIED -- margin widths in pixels --
marginheight%Pixels; #IMPLIED -- margin height in pixels --
scrolling (yes|no|auto) auto -- scrollbar or none --
align %IAlign; #IMPLIED -- vertical or horizontal alignment --
height %Length; #IMPLIED -- frame height --
width %Length; #IMPLIED -- frame width --
>
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
5/34
Introduction to forms
An HTML form is a section of a document containing normal content, markup, special elementscalled controls (checkboxes, radio buttons, menus, etc.), and labels on those controls. Users
generally "complete" a form by modifying its controls (entering text, selecting menu items,
etc.), before submitting the form to an agent for processing (e.g., to a Web server, to a mail
server, etc.)
First name:
Last name:
email:Male
Female
The FORMelement
action %URI; #REQUIRED -- server-side form handler --
method (GET|POST) GET -- HTTP method used to submit the
form--
enctype %ContentType; "application/x-www-form-urlencoded"
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload
--
name CDATA #IMPLIED -- name of form for scripting --
onsubmit %Script; #IMPLIED -- the form was submitted --
onreset %Script; #IMPLIED -- the form was reset --
accept-charset%Charsets; #IMPLIED -- list of supported charsets --
>
Controls
Users interact with forms through named controls.
A control's "control name"is given by its name attribute. The scope of the name attribute
for a control within a FORM element is the FORM element.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
6/34
Each control has both an initial value and a current value, both of which are characterstrings. Please consult the definition of each control for information about initial valuesand possible constraints on values imposed by the control. In general, a control's "initialvalue"may be specified with the control element's value attribute. However, the initial
value of a TEXTAREA element is given by its contents, and the initial value of an
OBJECT element in a form is determined by the object implementation (i.e., it liesoutside the scope of this specification).
Controls
Users interact with forms through named controls.
A control's "control name"is given by its name attribute. The scope of the name attribute
for a control within a FORM element is the FORM element.
Each control has both an initial value and a current value, both of which are characterstrings. Please consult the definition of each control for information about initial valuesand possible constraints on values imposed by the control. In general, a control's "initialvalue"may be specified with the control element's value attribute. However, the initial
value of a TEXTAREA element is given by its contents, and the initial value of an
OBJECT element in a form is determined by the object implementation (i.e., it liesoutside the scope of this specification).
The INPUT element
"(TEXT | PASSWORD | CHECKBOX |
RADIO | SUBMIT | RESET |
FILE | HIDDEN | IMAGE | BUTTON)"
>
%attrs; -- %coreattrs, %i18n, %events --
type %InputType; TEXT -- what kind of widget is needed --
name CDATA #IMPLIED -- submit as part of form --value CDATA #IMPLIED -- Specify for radio buttons and
checkboxes --
checked (checked) #IMPLIED -- for radio buttons and check boxes -
-
disabled (disabled) #IMPLIED -- unavailable in this context --
readonly (readonly) #IMPLIED -- for text and passwd --
size CDATA #IMPLIED -- specific to each type of field --
maxlength NUMBER #IMPLIED -- max chars for text fields --
src %URI; #IMPLIED -- for fields with images --
alt CDATA #IMPLIED -- short description --
usemap %URI; #IMPLIED -- use client-side image map --
ismap (ismap) #IMPLIED -- use server-side image map --
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
7/34
tabindex NUMBER #IMPLIED -- position in tabbing order --
accesskey %Character; #IMPLIED -- accessibility key character --
onfocus %Script; #IMPLIED -- the element got the focus --
onblur %Script; #IMPLIED -- the element lost the focus --onselect %Script; #IMPLIED -- some text was selected --
onchange %Script; #IMPLIED -- the element value was changed --
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload
--
>
Control types created with INPUT
The control type defined by the INPUT element depends on the value of the typeattribute:
text
Creates a single-line text input control.password
Like "text", but the input text is rendered in such a way as to hide the characters (e.g., a series ofasterisks). This control type is often used for sensitive input such as passwords. Note that thecurrent value is the text enteredby the user, not the text rendered by the user agent.
Note. Application designers should note that this mechanism affords only lightsecurity protection. Although the password is masked by user agents from casualobservers, it is transmitted to the server in clear text, and may be read by anyonewith low-level access to the network.
checkboxCreates a checkbox.
radioCreates a radio button.
submit
Creates a submit button.image
Creates a graphical submit button. The value of the src attribute specifies the URI of the imagethat will decorate the button. For accessibility reasons, authors should provide alternate text forthe image via the alt attribute.
When a pointing device is used to click on the image, the form is submitted and
the click coordinates passed to the server. The x value is measured in pixelsfrom the left of the image, and the y value in pixels from the top of the image. Thesubmitted data includes name.x=x-valueand name.y=y-valuewhere "name"isthe value of the name attribute, and x-valueand y-valueare the x and y
coordinate values, respectively.
If the server takes different actions depending on the location clicked, users ofnon-graphical browsers will be disadvantaged. For this reason, authors shouldconsider alternate approaches:
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
8/34
Use multiple submit buttons (each with its own image) in place of a single graphicalsubmit button. Authors may use style sheets to control the positioning of these buttons.
Use a client-side image map together with scripting.
resetCreates a reset button.
button
Creates a push button. User agents should use the value of the value attribute as the button'slabel.
hidden
Creates a hidden control.file
Creates a file select control. User agents may use the value of the value attribute as the initial
file name.
17.4.2 Examples of forms containing INPUT controls
The following sample HTML fragment defines a simple form that allows the user to entera first name, last name, email address, and gender. When the submit button isactivated, the form will be sent to the program specified by the
Dynamic sites
Dynamic sites are those where the content and design live separately. The content lives in a database that is placed
on a webpage only when needed or asked. The benefit of this is that it allows for quicker page loading and it allows
just about anyone, with limited or no web design experience, to update their own website via an administrative
backend. This set-up is ideal for those who wish to make frequent changes to their websites including text and imageupdates. Dynamic sites are also great for image galleries, online calendars or e-commerce, etc.
Client-side
The Client-side content is generated on the client's computer. The web browser retrieves a page from the server, then
processes the code embedded in the page (typically written in JavaScript) and displays the retrieved page's content
to the user.
The innerHTML property (or write command) can illustrate the "Client-side dynamic page" generation: two distinct
pages, A and B, can be regenerated (by an "event response dynamic") as document.innerHTML = A and
document.innerHTML = B; or "on load dynamic" by document.write(A) and document.write(B).
[edit] Server-side
Server-side dynamic content is a little bit more complicated.
The client sends the server the request.
The server receives the request and processes the server-side script such as PHP based on the query string,HTTP POST data, cookies, etc.
o For example:
ASP.NET Features ASP.NET is not just a simple upgrade or the latest version of ASP. ASP.NET combines
unprecedented developer productivity with performance, reliability, and deployment.
ASP.NET redesigns the whole process. It's still easy to grasp for new comers but itprovides many new ways of managing projects. Below are the features of ASP.NET.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
9/34
Easy Programming Model ASP.NET makes building real world Web applications dramatically easier. ASP.NET
server controls enable an
HTML-like style of declarative programming that let you build great pages with farless code than with classic ASP. Displaying data, validating user input, anduploading files are all amazingly easy. Best of all, ASP.NET pages work in all
browsers including Netscape, Opera, AOL, and Internet Explorer. Flexible Language Options ASP.NET lets you leverage your current programming language skills. Unlike classic
ASP, which supports only interpreted VBScript and JScript, ASP.NET now supports
more than 25 .NET languages (built-in support for VB.NET, C#, and JScript.NET),giving you unprecedented flexibility in your choice of language.
Great Tool Support
You can harness the full power of ASP.NET using any text editor, even Notepad. ButVisual Studio .NET adds the productivity of Visual Basic-style development to the
Web. Now you can visually design ASP.NET Web Forms using familiar drag-drop-
doubleclick techniques, and enjoy full-fledged code support including statement
completion and color-coding. VS.NET also provides integrated support for debuggingand deploying ASP.NET Web applications. The Enterprise versions of Visual Studio.NET deliver life-cycle features to help organizations plan, analyze, design, build,
test, and coordinate teams that develop ASP.NET Web applications. These includeUML class modeling, database modeling (conceptual, logical, and physical models),testing tools (functional, performance and scalability), and enterprise frameworks
and templates, all available within the integrated Visual Studio .NET environment.
Rich Class Framework Application features that used to be hard to implement, or required a 3rd-party
component, can now be added in just a few lines of code using the .NET Framework.
The .NET Framework offers over 4500 classes that encapsulate rich functionality like
XML, data access, file upload, regular expressions, image generation, performancemonitoring and logging, transactions, message queuing, SMTP mail, and much more.
With Improved Performance and Scalability ASP.NET lets you use serve more users
with the same hardware. Compiled execution
ASP.NET is much faster than classic ASP, while preserving the "just hit save" updatemodel of ASP. However, no explicit compile step is required. ASP.NET will
automatically detect any changes, dynamically compile the files if needed, and store
the compiled results to reuse for subsequent requests. Dynamic compilation ensuresthat your application is always up to date, and compiled execution makes it fast.
Most applications migrated from classic
ASP see a 3x to 5x increase in pages served.
Rich output caching ASP.NET output caching can dramatically improve the performance and scalability of
your application. When output caching is enabled on a page, ASP.NET executes the
page just once, and saves the result in memory in addition to sending it to the user.When another user requests the same page, ASP.NET serves the cached result frommemory without re-executing the page. Output caching is configurable, and can be
used to cache individual regions or an entire page. Output caching can dramaticallyimprove the performance of data-driven pages by eliminating the need to query thedatabase on every request.
Web-Farm Session State
ASP.NET session state lets you share session data user-specific state values across
all machines in your Web farm. Now a user can hit different servers in the Web farmover multiple requests and still have full access to her session. And since business
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
10/34
components created with the .NET Framework are free-threaded, you no longer needto worry about thread affinity.
Enhanced Reliability
ASP.NET ensures that your application is always available to your users. Memory Leak, DeadLock and Crash Protection ASP.NET automatically detects and recovers from errors like deadlocks and memory
leaks to ensure your application is always available to your users. For example, saythat your application has a small memory leak, and that after a week the leak hastied up a significant percentage of your server's virtual memory. ASP.NET will detectthis condition, automatically start up another copy of the ASP.NET worker process,
and direct all new requests to the new process. Once the old process has finishedprocessing its pending requests, it is gracefully disposed and the leaked memory isreleased. Automatically, without administrator intervention or any interruption of
service, ASP.NET has recovered from the error. Easy Deployment
ASP.NET takes the pain out of deploying server applications. "No touch" application
deployment. ASP.NET dramatically simplifies installation of your application. With
ASP.NET, you can deploy an entire application as easily as an HTML page, just copyit to the server. No need to run regsvr32 to register any components, andconfiguration settings are stored in an XML file within the application.
Dynamic update of running application ASP.NET now lets you update compiled components without restarting the web
server. In the past with classic COM components, the developer would have to
restart the web server each time he deployed an update. With ASP.NET, you simply
copy the component over the existing DLL, ASP.NET will automatically detect thechange and start using the new code.
Easy Migration Path
You don't have to migrate your existing applications to start using ASP.NET. ASP.NET
runs on IIS side-by-side with classic ASP on Windows 2000 and Windows XPplatforms. Your existing ASP applications continue to be processed by ASP.DLL, while
new ASP.NET pages are processed by the new ASP.NET engine. You can migrate
application by application, or single pages. And ASP.NET even lets you continue touse your existing classic COM business components.
XML Web Services XML Web services allow applications to communicate and share data over the
Internet, regardless of operating system or programming language. ASP.NET makes
exposing and calling XML Web Services simple. Any class can be converted into anXML Web Service with just a few lines of code, and can be called by any SOAP
client. Likewise, ASP.NET makes it incredibly easy to call XML Web Services from
your application. No knowledge of networking, XML, or SOAP is required.
Mobile Web Device Support ASP.NET Mobile Controls let you easily target cell phones, PDAs and over 80 mobile
Web devices. You write your application just once, and the mobile controls
automatically generate WAP/WML, HTML, or iMode as required by the requestingdevice.
Improvements in ASP.NET 2.0
ASP.NET 2.0 was designed to make web development easier and quicker.
Design goals for ASP.NET 2.0:
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
11/34
Increase productivity by removing 70% of the code Use the same controls for all types of devices
Provide a faster and better web server platform
Simplify compilation and installation Simplify the administration of web applications
What's New in ASP.NET 2.0?
Some of the new features in ASP.NET 2.0 are:
Master Pages, Themes, and Web Parts Standard controls for navigation Standard controls for security
Roles, personalization, and internationalization services
Improved and simplified data access controls Full support for XML standards like, XHTML, XML, and WSDL Improved compilation and deployment (installation)
Improved site management New and improved development tools
Master Pages
ASP.NET didn't have a method for applying a consistent look and feel for a whole web site.
Master pages in ASP.NET 2.0 solves this problem.
A master page is a template for other pages, with shared layout and functionality. The master page defines
placeholders for content pages. The result page is a combination (merge) of the master page and the content page.
Read more about master pages.
Themes
Themes is another feature of ASP.NET 2.0. Themes, or skins, allow developers to create a customized look for web
applications.
Design goals for ASP.NET 2.0 themes:
Make it simple to customize the appearance of a site
Allow themes to be applied to controls, pages, and entire sites Allow all visual elements to be customized
Web Parts
ASP.NET 2.0 Web Parts can provide a consistent look for a site, while still allowing user customization of style and
content.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
12/34
New controls:
Zone controls - areas on a page where the content is consistent
Web part controls - content areas for each zone
Navigation
ASP.NET 2.0 has built-in navigation controls like
Site Maps
Dynamic HTML menus
Tree Views
Security
Security is very important for protecting confidential and personal information.
In ASP.NET 2.0 the following controls has been added:
A Login control, which provides login functionality
A LoginStatus control, to control the login status
A LoginName control to display the current user name A LoginView control, to provide different views depending on login status
A CreateUser wizard, to allow creation of user accounts A PasswordRecovery control, to provide the "I forgot my password" functionality
Roles and Personalization
Internet communities are growing very popular.
ASP.NET 2.0 has personalization features for storing user details. This provides an easy way to customize user (and
user group) properties.
Internationalization
Reaching people with different languages is important if you want to reach a larger audience.
ASP.NET 2.0 has improved support for multiple languages.
Data Access
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
13/34
Many web sites are data driven, using databases or XML files as data sources.
With ASP.NET this involved code, and often the same code had to be used over and over in different web pages.
A key goal of ASP.NET 2.0 was to ease the use of data sources.
ASP.NET 2.0 has new data controls, removing much of the need for programming and in-depth knowledge of data
connections.
Mobility Support
The problem with Mobile devices is screen size and display capabilities.
In ASP.NET, the Microsoft Mobile Internet Toolkit (MMIT) provided this support.
In ASP.NET 2.0, MMIT is no longer needed because mobile support is built into all controls.
Images
ASP.NET 2.0 has new controls for handling images:
The ImageMap control - image map support
The DynamicImage control - image support for different browsers
These controls are important for better image display on mobile devices, like hand-held computers and cell
phones.
Automatic Compilation
ASP.NET 2.0 provides automatic compilation. All files within a directory will be compiled on the first run, including
support for WSDL, and XSD files.
Compiled Deployment (Installation) and Source Protection
ASP.NET 2.0 also provides pre-compilation. An entire web site can be pre-compiled. This provides an easy way to
deploy (upload to a server) compiled applications, and because only compiled files are deployed, the source code
is protected.
Site Management
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
14/34
ASP.NET 2.0 has three new features for web site configuration and management:
New local management console
New programmable management functions (API) New web-based management tool
Development Tools
With ASP.NET Visual Studio.NET was released with project and design features targeted at corporate developers.
With ASP.NET 2.0, Visual Studio 2005 was released.
Key design features for Visual Studio 2005 include:
Support for the features described above
Upload files from anywhere (FTP, File System, Front Page....)
No project files, allowing code to be manipulated outside Visual Studio Integrated Web Site Administration Tool
No "build" step - ability to compile on first runVisual Web Developer is a new free ASP.NET 2.0 tool for non-corporate developers who don't have access to
Visual Studio.NET.
ASP.Net Controls: Asp.net controls are come in Three different form:
1. Asp.net user controls2. Asp.net server controls3. Asp.net web controls
ASP.NET User Controls Overviewyou might need functionality in a control that is not provided by the built-in ASP.NET Web server controls. In those
cases, you can create your own controls. You have two options. You can create:
User controls. User controls are containers into which you can put markup and Web server controls. You
can then treat the user control as a unit and define properties and methods for it.
Custom controls. A custom control is a class that you write that derives from Control or WebControl.
User controls are substantially easier to create than custom controls, because you can reuse existing controls. They
make it particularly easy to create controls with complex user interface elements.
This topic provides an overview of working with ASP.NET user controls.
User Control Structure
You create the user control in much the same way you create an ASP.NET page and then add the markup
and child controls that you need. A user control can include code to manipulate its contents like a page
can, including performing tasks such as data binding.
A user controls differs from an ASP.NET Web page in these ways:
The file name extension for the user control is .ascx.
Instead of an @ Page directive, the user control contains an @ Control directive that defines configuration
and other properties.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
15/34
User controls cannot run a
any control.
The user control does not
page.
You can use the same HTML eleme
control that you do on an ASP.NET
For example, if you are creating a
controls onto the control and creat
You add a user control to a page b
file that contains the user control,
the page.
Defining Properties and Method
You can define properties and met
for a user control, you make it poss
Events in User Controls
When a user control contains Web
raised by the child controls. For exa
the user control for the button's Cli
Referencing External Resources
When a user control runs, referenc
using the URL of the user control as
For example, if the user control coImages/Button1.gif, the UR
path to the image.
If the user control references a res
path that resolves to the correct fol
Caching and User Controls
User controls can support caching
controls to pages and to cache port
ASP.NET Web Server Controls
When you create ASP.NET Web pa
HTML server controls HT
controls expose an object
s stand-alone files. Instead, you must add them to AS
have html, body, or form elements in it. These eleme
ts (except the html, body, or form elements) and W
eb page.
ser control to use as a toolbar, you can put a series o
e event handlers for the buttons.
registering it on the host page. When you register i
a tag prefix, and a tag name that you will use to dec
for a User Control
ods for a user control the same way you do for a pag
ible to set its properties declaratively and in code.
server controls, you can write code in the user contr
mple, if your user control contains a Button control,
ck event.
s to external resources such as images or anchors to
the base URL.
tains an Image control whose ImageUrl property is s
of the image is added to the URL of the user control
urce that is not in a subfolder of the user control itse
der at run time.
irectives that are separate from the host page. You c
ions of a page
verview
es, you can use these types of controls:
ML elements exposed to the server so you can progra
model that maps very closely to the HTML elements t
P.NET pages, as you would
nts must be in the hosting
b controls on a user
f Button Web server
t, you specify the .ascx
lare the user control on
e. By defining a property
l to handle the events
ou can create a handler in
other pages are resolved
et to
to resolve the complete
lf, you must provide a
an therefore add user
m them. HTML server
hat they render.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
16/34
Web server controls Con
controls include not only f
such as a calendar, menus
Validation controls Contrsuch as the TextBox contr
specific value or pattern o
User controls Controls th
other ASP.NET Web pages,
HTML Server Controls
HTML server controls are HTML ele
attributes that make them program
not available to the server. Instead,
by converting HTML elements to H
server.
The object model for HTML server
HTML attributes are exposed in HT
Any HTML element on a page can b
During parsing, the ASP.NET page f
attribute. If you want to reference
to the control.
HTML server controls offer the foll
An object model that youEach server control expos
programmatically in serve
A set of events for which y
form, except that the even
The ability to handle event
Automatic maintenance o
that the user entered into
browser.
Interaction with ASP.NET v
information into a control.
Data binding to one or mo
Support for styles if the AS
Pass-through of custom atthe page framework will r
browser-specific attribute
Web Server Controls
Web server controls are a second s
one-to-one to HTML server control
rendered by the control can be quit
rols with more built-in features than HTML server co
rm controls such as buttons and text boxes, but also
and a tree view control
ols that incorporate logic to enable you to what userl. Validation controls enable you to check for a requi
characters, to verify that a value lies within a range,
at you create as ASP.NET Web pages. You can embed
which is an easy way to create toolbars and other re
ments (or elements in other supported markup, such
mable in server code. By default, HTML elements on
they are treated as opaque text and passed through
ML server controls, you expose them as elements yo
ontrols maps closely to that of the corresponding ele
L server controls as properties.
e converted to an HTML server control by adding the
amework creates instances of all elements containin
he control as a member within your code, you shoul
owing features:
an program against on the server using familiar objes properties that enable you to manipulate the contr
code.
u can write event handlers in much the same way yo
t is handled in server code.
s in client script.
the control's state. When the page makes a round tri
TML server controls are automatically maintained a
alidation controls so you can verify that a user has en
re properties of the control.
P.NET Web page is displayed in a browser that suppo
ributes. You can add any attributes you need to an Hnder them without any change in functionality. This
to your controls.
t of controls designed with a different emphasis. Th
. Instead, they are defined as abstract controls in wh
e different from the model that you program against
ntrols. Web server
special-purpose controls
enter for input controlsed field, to test against a
and so on
ASP.NET user controls in
usable elements
as XHTML) containing
an ASP.NET Web page are
to the browser. However,
u can program on the
ments. For example,
attribute runat="server".
g the runat="server"
also assign an id attribute
t-oriented techniques.ol's markup attributes
u would in a client-based
p to the server, the values
d sent back to the
tered appropriate
rts cascading style sheets.
TML server control andnables you to add
y do not necessarily map
ich the actual markup
.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
17/34
Web server controls offer all of the
mapping to elements) and these ad
A rich object model that p
Automatic browser detectmarkup.
For some controls, the abil
For some controls, the abil
or is instead cached and ra
Support for themes, which
Ability to pass events from
ASP.NET Web Parts Control
ASP.NET Web Parts is an integrated
content, appearance, and behavior
users on the site or to individual us
a user's personal preferences acros
Using the Web Parts control set, yo
Personalize page content.
minimize them like ordina
Personalize page layout. U
appearance, properties, a
Export and import control
or sites, retaining the prop
and configuration demand
Create connections. Users
control could display a gra
connection itself, but the Manage and personalize si
who can access a site or p
administrative role could s
administrators from perso
Web Parts Essentials
The Web Parts control set consists
components, and actual Web Parts
Developer Scenarios for Using W
You will typically work with Web Pa
individual Web Parts controls, or cr
Page Development
Page developers can use visual desi
Parts. One advantage in using a too
drag-and-drop creation and configu
features described above for HTML server controls (
ditional features:
ovides type-safe programming capabilities.
ion. The controls can detect browser capabilities and
ity to define your own layout for the control using Te
ity to specify whether a control's event causes imme
ised when the page is submitted.
enable you to define a consistent look for controls t
a nested control (such as a button in a table) to the
set of controls for creating Web sites that enable en
of Web pages directly from a browser. The modificat
ers. When users modify pages and controls, the settin
s future browser sessions, a feature called personaliz
u as a developer can enable end users to:
Users can add new Web Parts controls to a page, rem
y windows.
sers can drag a Web Parts control to a different zone
d behavior.
. Users can import or export Web Parts control settin
erties, appearance, and even the data in the controls
s on end users.
can establish connections between controls so that,
ph for the data in a stock ticker control. Users could p
ppearance and details of how the chart control displte-level settings. Authorized users can configure site-
ge, set role-based access to controls, and so on. For
et a Web Parts control to be shared by all users, and
nalizing the shared control.
f three main building blocks: personalization, user in
UI controls
eb Parts
rts in one of three ways: creating pages that use We
eating complete, personalizable Web applications, su
gn tools such as Microsoft Visual Studio 2005 to crea
l such as Visual Studio is that the Web Parts control s
ration of Web Parts controls in a visual designer.
xcept one-to-one
render appropriate
mplates.
iate posting to the server
roughout your site.
ontainer control.
users to modify the
ions can be applied to all
gs can be saved to retain
ation.
ove them, hide them, or
on a page, or change its
gs for use in other pages
. This reduces data entry
or example, a chart
ersonalize not only the
ys the data.level settings, determine
xample, a user in an
prevent users who are not
terface (UI) structural
Parts controls, creating
ch as a portal.
e pages that use Web
et provides features for
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
18/34
Control Development
You can use any existing ASP.NET control as a Web Parts control, including standard Web server controls, customserver controls, and user controls. For maximum programmatic control of your environment, you can also create
custom Web Parts controls that derive from the WebPart class
Web Application Development
Developing fully integrated and personalizable Web applications--such as a portal-- involves the most
comprehensive use of Web Parts. You can develop a Web site that allows extensive user personalization of the UI
and content--with features similar to MSN. Or you can even develop a packaged application that can be shipped
and used by companies or fee-based ISPs that provide portal hosting services.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
19/34
Client Side Validation
Text Validation
function Validate()
{
alert('its running');
var v1=document.getElementById("TextBox1");
alert(v1);
if(v1.value=="")
{
alert('no data');
v1.focus();
return false;
}
else
return true;
}
Email Validation
function Validate()
{
alert('its running');
var v1=document.getElementById("TextBox1");
alert(v1);
if(v1.value=="")
{
alert('no data');
v1.focus();return false;
}
else
{
with(v1)
{
lgth=value.length;
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
20/34
Server Side Validation
Number/Range validation
Reguler Expression Validator
Character Description
* Zero or more occurrences of the previous character or sub expression, for exp
7*8 matches 7778 or just 8
+ One or more occurrence of the previous character or sub sub expression, for
example 7+8 matches 7778 but not 8
() Groups a sub expression that will be treated as single element, for example
(78)+ matches 78 and 787878
| Either of two matches, for example, 8|6 matches 8 or 6
[] Matches one character in range of valid characters, for example [a-c] matches
a,b or c
[^] Matches a character that innt in the given range, for example [^A-B] matches
any character except A and B
. Any character except newline, for example .here matches where and there
\s Any whitespace character (such as tab or space)
\S Any non whitespace character
\d Any digit character
\D Any character that inst a digit
\w Any word character (latter, number or underscore)
Table of commonly used Regular Expression
Content Regular Expression Description
E-Mail Address \S+@\S+\.\S+ Check for an at (@) sign and (.) andallow non whitespace characters only
Password \w+ Any sequence of word character
(letter, space or underscore)
Specific-length
password
\w[4,10] A password that must be at least foru
characters long but no longer then
ten characters
Advanced password [a-zA-Z]\w[3,9] As with the specific length password,
this regular expression will allow four
to ten total characters, the twist is
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
21/34
that the first achracter must fall in
the range of a-z or A-Z (that say it
must start with a nonaccented
ordinary letter)
Social security
number
\d[3]-\d[2]-\d9[4] A sequence of three, two, four digit
with each group separated by a dash.
ASPX code for Validate the Email using Regular Expression is:
Ad-Rotator Control
the basic purpose of the AdRotator is to provide a banner type graphic on a page that is chosen
randomly from a group of possible banners. In other workds, every time the page is requested,
a different banner could be chosen and displayed, which is the rotation indicated by the
name AdRotator. In asp.net you can store the list of images in a XML file this file use as a source
file for the images.
Example:
The XML file for AdRotator is:
images/1.jpg
http://aspnet101.com
The best ASP.Net web site in the world!
1
images/2.jpg
http://aspnet101.com
The best ASP.Net web site in the world!
2
images/3.jpghttp://aspnet101.com
The best ASP.Net web site in the world!
3
The ASPX file for the AdRotator is:
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
22/34
ADO DataBase
ADO (ActiveX Data Object) is a Microsoft Active-X component that automatically installed with Microsoft IIS ADO is
a programming interface to access data in a database, for creating an ADO connection to a database user have tocreate an ADO recordset, Open the recordset, Extract the data you need from the recordset, Close therecordset, Close the connection. In ADO, representation of data is the recordset, A recordset looks like a singletable. In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. InADO.NET, rows are represented as collections, so you can loop through a table as you would through anycollection, or access particular rows via ordinal or primary key index, If a recordset is to contain data from multipledatabase tables, it must use a JOIN query, which assembles the data from the various database tables into a singleresult table.
ADO.Net Database
It is also known as ActiveX Data Object is a Microsoft Active-X component that automatically installed withMicrosoft IIS, the key feature of ADO.Net is representation of data in the DataSet. This is the importantdifferences between ADO and ADO.Net, a dataset is a collection of one or more tables. The tables within a datasetare called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database
tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds toa single database table or view.
Features of ADO.Net
1. The DataSet2. Disconnected Access3. XML Integration
The DataSet: the dataset is a cache of information that has been queried from your databse. The innovativefeatures of the dataset are that its disconnected and can store more than one table; a dataset could store a list ofcustomers, a list of products, and a list of customer orders.
Disconnected Access: disconnected access is the one of the most important characteristics of ADO.Net with
previous database access technologies its easy to hold open an connection with database server while your codedoes some work , this live connection allows you to make immediate update, and you can even see the changesmade by other user in real time, unfortunately database servers can provide only a limited number of connectionsThe longer you keep a connection open the greater chance becomes that another user will be prevented fromaccession the database in a poorly written program. In ADO.Net has you still create a connection to a database,but youre able to close the connection much faster, because to full a dataset object with the completely of theinformation drawn from the database. You can ten close the connection before you start procession the data.
XML Integration: ADO.Net has deep support for XML this fact isnt immediately obvious when youre working witha Dataset object, even you can access the information in the dataset as an XML document, you can even modifyvalues, remove rows and add new records by modifying the XML, and the dataset will be updated automatically.
ADO.Net Architecture
The ADO.NET DataSet is explicitly designed for data access independent of any data source. As a result, it can be
used with multiple and differing data sources, used with XML data, or used to manage data local to the application.The DataSet contains a collection of one or more DataTable objects consisting of rows and columns of data, andalso primary key, foreign key, constraint, and relation information about the data in the DataTable objects
ADO.NET architecture
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
23/34
A DO.Net Data Connection Type & Provider
Creating the SQL Connection in ASP.Net:
First Chose View->Server Explorer to show the server explorer windowRight click on Data Connection node and choose add connectionNow select Microsoft SQL Server and click continueWrite the Localhost\SQLEXPRESS as server name and test theConnection if the connection get success the message will show on theScreen.Now in the select or enter database name, select the name of database that you want for your design. By default itis master
ADO.Net
Data Objects
OLE DB
.Net Provider
Oracle
.Net provider
ODBC
.Net Provider
SQL Server
.Net Provider
SQL
server
Data
Source
Oracle
Database
Data
Source
OLE DB Driver ODBC Driver
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
24/34
Data Binding
Connected data access
SqlConnection con = newSqlConnection("Data
Source=localhost\\SQLEXPRESS;Initial Catalog=master;Integrated
Security=True");
SqlDataReader dr;
protectedvoid Page_Load(object sender, EventArgs e)
{
try
{
SqlCommand cmd = newSqlCommand("select * from [user]", con);
con.Open();
dr = cmd.ExecuteReader();
dr.Read();
Response.Write(dr[0] + " " + dr[1]);
Response.Write(con.State.ToString());
}
catch (Exception err)
{
Response.Write(err.ToString());
}
finally
{
con.Close();
Response.Write(con.State.ToString());}
}
Disconnected Data Access
With disconnected data first youll make your changes through the dataset rather than with
direct commands, also youll need to watch for the problems that can occur if more than one
user attempts to make conflicting changes that the same time or of you need to commit
changes to multiple tables in this simple one page scenario. With disconnected data access a
copy of the data is retained in memory while your code is running, changes are tracked
automatically using the built-in features of the dataset object.
You fill the dataset much the same way that you connect a datareader.
SqlConnection con = newSqlConnection("Data
Source=localhost\\SQLEXPRESS;Initial Catalog=master;Integrated
Security=True");
SqlDataAdapter da;
SqlCommandBuilder cmd;
DataSet ds=newDataSet();
protectedvoid Page_Load(object sender, EventArgs e)
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
25/34
{
try
{
con.Open();
da = newSqlDataAdapter("select * from [user]", con);
cmd = newSqlCommandBuilder(da);
da.Fill(ds, "user");
da = newSqlDataAdapter("select * from [user1]", con);
da.Fill(ds, "user1");
Response.Write(con.State.ToString());
}
catch (Exception err)
{
Response.Write(err.ToString());
}
finally{
con.Close();
Response.Write(con.State.ToString());
}
foreach (DataRow row in ds.Tables["user"].Rows)
{
Response.Write(row[0] + " " + row[1]);
}
foreach (DataRow row in ds.Tables["user1"].Rows)
{
Response.Write(row[0] + " " + row[1] + " " + row[2]);
}
}
Data Fill in Data Grid
In XML file
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
26/34
Web Services: Web Services can convert HTML applications into Web-applications it is application componentsthat communicate using open protocols it is self-contained and self-describing. Web services can be discovered
using UDDI it can be used by other applications. And the most applicable basis in XML+HTML of web services
XML provides a language which can be used between different platforms and programming languages and stillexpress complex messages and functions.
Web services platform elements:
SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)
Web Services have Two Types of Uses
Reusable application-components.
There are things applications need very often. So why make these over and over again?
Web services can offer application-components like: currency conversion, weather reports, or even languagetranslation as services.
Connect existing software.
Web services can help to solve the interoperability problem by giving different applications a way to link their data.
With Web services you can exchange data between different applications and different platforms.
View State:
View state is use to remember the sate of control it is a hidden filed and automatically returned
to the server with every post back, however view stare isnt limited to server controls, your web
page code can add bits or information directly to the view state collection of the containing
page. Includes simple data types and your own custom objects.
The view state property of the page provides the view state collection, this property to an
instance of the stateBag collection class.
View state exampleprotectedvoid Page_Load(object sender, EventArgs e)
{
Label1.Text = "This page have no Counter Value";
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
int counter;
if (ViewState["counter"] == null)
{
counter = 1;
}
else
{
counter = (int)ViewState["counter"] + 1;
}
ViewState["counter"] = counter;
Label1.Text = "The counter value is :" + counter.ToString();
}
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
27/34
Session State:A session is defined as the period of time that a unique user interacts with a Web application. Active Server Pages(ASP) developers who wish to retain data for unique user sessions can use session state.
Programmatically, session state is nothing more than memory in the shape of a dictionary or hash table, e.g. key-value pairs, which can be set and read for the duration of a user's session. For example, a user selects stocks totrack and the Web application can store these values in the user's ASP session instance
ASP maintains session state by providing the client with a unique key assigned to the user when the sessionbegins. This key is stored in an HTTP cookie that the client sends to the server on each request. The server canthen read the key from the cookie and re-inflate the server session state.
Limitation of ASP Session State
Process dependent. ASP session state exists in the process that hosts ASP; thus the actions that affect
the process also affect session state. When the process is recycled or fails, session state is lost.
Server farm limitations. As users move from server to server in a Web server farm, their session state
does not follow them. ASP session state is machine specific. Each ASP server provides its own session
state, and unless the user returns to the same server, the session state is inaccessible. While network IP
level routing solutions can solve such problems, by ensuring that client IPs are routed to the originating
server, some ISPs choose to use a proxy load-balancing solution for their clients.
Cookie dependent. Clients that don't accept HTTP cookies can't take advantage of session state. Some
clients believe that cookies compromise security and/or privacy and thus disable them, which disables
session state on the server
OverCome in ASP.NET Session State
Process independent. ASP.NET session state is able to run in a separate process from the ASP.NET host
process. If session state is in a separate process, the ASP.NET process can come and go while the session
state process remains available.
Support for server farm configurations. By moving to an out-of-process model, ASP.NET also solves
the server farm problem. The new out-of-process model allows all servers in the farm to share a session
state process. You can implement this by changing the ASP.NET configuration to point to a common
server.
Cookie independent. Although solutions to the problem of cookieless state management do exist for
classic ASP, they're not trivial to implement. ASP.NET, on the other hand, reduces the complexities of
cookieless session state to a simple configuration setting
Session configuration
Mode. The mode setting supports three options: inproc, sqlserver, and stateserver. As stated earlier,
ASP.NET supports two modes: in process and out of process. There are also two options for out-of-process
state management: memory based (stateserver), and SQL Server based (sqlserver).
Cookieless. The cookieless option for ASP.NET is configured with this simple Boolean setting.
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
28/34
Timeout. This option controls the length of time a session is considered valid. The session timeout is a
sliding value; on each request the timeout period is set to the current time plus the timeout value
Sqlconnectionstring. The sqlconnectionstring identifies the database connection string that names the
database used for mode sqlserver.
Server. In the out-of-process mode stateserver, it names the server that is running the required Windows
NT service: ASPState.
Port. The port setting, which accompanies the server setting, identifies the port number that corresponds
to the server setting for mode stateserver.
In-process ModeIn-process mode is the default setting for ASP.NET. When this setting is used, the only other session config.websettings used are cookieless and timeout.
Out-of-process Mode
Included with the .NET SDK is a Windows NT service: ASPState. This Windows service is what ASP.NET uses forout-of-process session state management. To use this state manager, you first need to start the service. To startthe service, open a command prompt and type:
SQL Server ModeThe SQL Server mode option is similar to that of the Windows NT Service, except that the information persists toSQL Server rather than being stored in memory.To use SQL Server as our session state store, we first must create the necessary tables and stored procedures thatASP.NET will look for on the identified SQL Server.
Cookieless StateThe last new feature that we can configure for ASP.NET session state is cookieless session state. Essentially thisfeature allows sites whose clients choose not to use cookies to take advantage of ASP.NET session state.This is done by modifying the URL with an ID that uniquely identifies the session:http://localhost/(lit3py55t21z5v55vlm25s55)/Application/SessionState.aspx
session State Example:
protectedvoid Page_Load(object sender, EventArgs e)
{
Session["dsinfo"] = "dsinfo";
Label1.Text = Session.SessionID;
Label1.Text += Session.IsCookieless.ToString();
}
Application State
Users can share information throughout your application by using the HttpApplicationState class, most commonlyaccessed through the Application property of the HttpContext object
Application State OverviewAn ASP.NET application is the sum of all files, pages, handlers, modules, and code that reside in a given virtualdirectory and its subdirectories and that users can request through that virtual directory hierarchy.For example, if you develop an application that calculates investment benefits for your company's intranet, youcould publish it in a virtual directory named \Invest on a Web server. The directory structure for such anapplication might look something like this:
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
29/34
\Invest\bin\image\xml
An instance of the HttpApplicatiowithin the virtual directory namespthat is stored on the computer.property named Application. All Hinstance of the context and therefo
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
30/34
WSDL (web Service Discription Language)The Web Services Description Language tool generates code for XML Web services and XMLWeb service clients from WSDL contract files, XSD schemas, and .discomap discovery
documents.WSDL.exe may generate classes with names like @string. These are valid type names using the @ prefix toallow type names that consist of a C# keyword.
wsdl [options] {URL | path}
URL The URL to a WSDL contract file (.wsdl), XSD schema file (.xsd), or discovery document (.disco). Notethat you cannot specify a URL to a .discomap discovery document.
Path The path to a local WSDL contract file (.wsdl), XSD schema file (.xsd), or discovery document (.disco or.discomap).
Note:Wsdl.exe does not retrieve includes and imports from the network when it is given a local file. Toenable Wsdl.exe to retrieve network resources while processing a local file, pass a URL to the local file.
For example, the following file uses the network to retrieve necessary resources: wsdl
File:///E:/Customers/WSDLS/Accounts.wsdl /out:proxy.cs
Asp.Net Threads
To efficiently service multiple client requests, Web servers make extensive use of concurrency
by launching multiple processes and/or spawning multiple threads to service requests and
perform work. ASP.NET is no exception and uses multiple threads within each worker process
to service requests HTTP many state repositories available in the pipeline, such as the
application-wide cache, the session state bag, the appliction state bag, or the per-request Items
collection of the HttpContext class By default, most handlers created to service requests are not
pooled. You can pool handlers and even control pooling on a per-handler basis through theIsReusable property of IhttpHandler, for this SimpleHandlerFactory class, which instantiates
.ashx-defined handlers. Typically, therefore, each request is serviced by a freshly allocated
instance of the appropriate handler class, Using the Web Application Stress tool against a server
hosting , you can test the average response time under heavy request traffic
Implementation of Threadspublicvoid PrintThread(){Label1.Text = "from First Thread";Label1.Text+= Thread.CurrentThread.Name;
}protectedvoid Button1_Click(object sender, EventArgs e){Thread.CurrentThread.Name = "Main Thread";Thread.Sleep(5000);PrintThread();}protectedvoid Button2_Click(object sender, EventArgs e){Thread.CurrentThread.Name = "Forked Thred";PrintThread();}
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
31/34
Serialization is a process of converting an object into a stream of data so that it can be is easily
transmittable over the network or can be continued in a persistent storage location. This
storage location can be a physical file, database or ASP.NET Cache. Serialization is the
technology that enables an object to be converted into a linear stream of data that can be
easily passed across process boundaries and machines
This stream of data needs to be in a format that can be understood by both ends of a
communication channel so that the object can be serialized and reconstructed easily. The
advantage of serialization is the ability to transmit data across the network in a cross-platform-
compatible format, as well as saving it in a persistent or non-persistent storage medium in a
non-proprietary format. Serialization is used by Remoting, Web Services SOAP for transmitting
data between a server and a client. De-serialization is the reverse; it is the process of
reconstructing the same object later. The Remoting technology of .NET makes use ofserialization to pass objects by value from one application domain to another. In this article I
will discuss .NET's support for Serialization and how we can build a class that supports custom
serialization.
Serialization in C#
protectedvoid Button1_Click(object sender, EventArgs e){FileStream sc = newFileStream(@"E:\xstream.xml", FileMode.Create);XmlTextWriter w = newXmlTextWriter(sc, null);
person p = newperson();p.name = "hello";XmlBuilder xml1 = newXmlBuilder();System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(typeof(person));Response.Write(x.ToString());x.Serialize(w, p);w.Close();}
De-serialization in C#
protectedvoid Button2_Click(object sender, EventArgs e)
{
person p1 = newperson();
FileStream fs = newFileStream(@"E:\xstream.xml", FileMode.Open);
XmlSerializer xr = newXmlSerializer(typeof(person));
p1=(person)xr.Deserialize(fs);
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
32/34
Response.Write(p1.name);
fs.Close();
}
Delegates in C#
A delegate is a type that references a method. Once a delegate is assigned a method, it behaves
exactly like that method. The delegate method can be used like any other method, with
parameters and a return value Any method that matches the delegate's signature, which
consists of the return type and parameters, can be assigned to the delegate. This makes is
possible to programmatically change method calls, and also plug new code into existing classes.
As long as you know the delegate's signature, you can assign your own delegated method.
publicdelegatevoidMsg(string message);
publicpartialclass_Default : System.Web.UI.Page
{
publicvoid showmsg(string msgs)
{
Response.Write(msgs);
}
protectedvoid Page_Load(object sender, EventArgs e)
{
Msg handler = showmsg;
handler("hello");
}
}
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
33/34
Practical Lab Assignment on ASP.Net
1. Create a XHTML Page using XHTML document notation for Your Curriculum Vitae, useTable View, Images and color control in web page ?
2. Create an ASP.Net web page using .Net framework same as question no. 1 and classify
the difference between XHTML and ASP.Net page.
3. Write The Steps of IIS Configuration in windows XP and Windows Vista ?
4. Create a Web Page in ASP.Net for creating an mark sheet of student having five
different subject the view of given page is like as:
Name of University/Institute
Marks statement
Name of Student: ......................................... Roll Number : .........................................
Enrollment Number: ................................... Year of Marks Statement:..................................
Class: .................
Statement of Marks
Subject Marks Given Out of Result
1. .............. .................... ................. ......
2. ............ ................... ................ ......
3. ............. .................. ................. ......
Grand Total: .................
Submit Button
In the above sheet when user click on submit button use client side and server side validations ?
5. Create a web page to implement Ad-Rotator Control ?
6. According to Question number 3 save the record after successfully click in database, the
database must be keep in \\SQLEXPRESS. On localhost ?
7. Create a web page that have database accessibility fetch the data form database using
Data Adapters and Dataset Also write the difference in both?
8. What is XML Document create an XML Document for ASP.Net code using XML Classes?
9. What is Web service how it can help us to make safe web application create an web
service that run on SOAP, and call it in your one of web page as references ?
-
8/14/2019 Prepaired by: Sujit Jhare Lecturer Barkatullah University,
34/34
10.Write the steps to create role based security in asp.net?
11.Write any five similarities and difference between JAVA and ASP.Net?
12.Write and Example in ASP.Net for Serialization and De-serialization of an object ?13.Write an example to implement of Delegate's in ASP.Net ?