AWD Assignment
AWD Assignment
1. It is a software development framework platform created by Microsoft that provides tools, libraries, and runtime to
build and run applications.
2. It allows developers to write code in multiple languages (C#, F#, [Link]) and run them on the same platform.
3. Its architecture mainly includes CLR, Class Library, CTS/CLS, Languages, and Application Models ([Link],
WinForms).
○ Memory allocation
○ Security
○ Error/Exception handling
● Converts code (C#, VB, etc.) into MSIL (Intermediate Language) → Machine code that computer understands.
○ Provides advanced features like database ([Link]), Web ([Link]), Graphics (WPF).
● FCL is built on BCL to offer advanced features. It saves time because we don’t need to write code from scratch.
(iii) Languages
● .NET supports multiple languages (C#, [Link], F#).
● All these languages are compiled into a common intermediate language (IL).
1. In C#, an array is a data structure that stores a fixed-size sequential collection of elements of the same data type.
2. Arrays provide a way to store multiple values in a single variable, accessed by an index.
3. Types of Arrays in C#:
i. Single-Dimensional Arrays:
● These are the simplest form of arrays, storing elements in a single row.
Code
numbers[0] = 10;
numbers[1] = 20; // ... and so on
● These arrays store elements in a grid-like structure with multiple rows and columns, where each row has
the same number of columns.
Code
matrix[0, 0] = 1;
matrix[1, 2] = 5;
● Also known as “arrays of arrays,” jagged arrays are a specific type of multidimensional array where the
elements are themselves arrays, and these inner arrays can have different lengths.
● This provides flexibility for storing data with varying row sizes.
● Code
Output
12
345
1. Inheritance in C# is an object-oriented programming (OOP) feature that allows one class to derive
properties and behaviors from another class.
2. It promotes code reusability, extensibility and establishes a natural hierarchical relationship between
classes.
3. Syntax
class BaseClass {
// Members of base class
}
class DerivedClass : BaseClass {
// Members of derived class
}
4. Inheritance is achieved using the : (colon) symbol.
5. Derived Class: The class that inherits the other class is known as asubclass(or a derived class, extended
class or child class).
6. Parent Class: The class whose features are inherited is known as a superclass (or a base class or a parent
class).
7. All classes in C# implicitly inherit from the [Link] class.
8. Types of Inheritance
C# directly supports the following inheritance forms:
i. Single Inheritance: One class derives from one base class.
ii. Multilevel Inheritance: A class derives from another derived class.
iii. Hierarchical Inheritance: Multiple classes derive from a single base class.
iv. Multiple Inheritance (Through Interfaces): A class can implement multiple interfaces,
achieving multiple inheritance indirectly, since C# does not allow multiple base classes.
i. Single Inheritance:
- In single inheritance, subclasses inherit the features of one superclass.
- the class A serves as a base class for the derived class B.
- class A serves as a base class for the derived class B, which serves as a base class for the derived class
C.
iii. Hierarchical Inheritance
- In Hierarchical Inheritance, one class serves as a superclass (base class) for more than one subclass.
- X and Y are sub-class (child class) that inherits property from class B and M and N are sub-class (child
class) that inherits property from class C. B is the parent class of X and Y and C is the parent class of M
and N.
[Link]
Answer
1. A delegate is a type that represents references to methods with a specific signature (return type + parameters).
4. To use a delegate, you must define it, assign a method, and then invoke it.
5. The method assigned to a delegate must have the same signature as the delegate.
9. They make code flexible and reusable, as you can switch methods without changing main logic.
Answer
1. Boxing
● An implicit conversion from a value type to an object or interface type.
● The value is "boxed" (wrapped) within a new object instance.
● This new object is then stored on the managed (garbage-collected) heap.
2. Unboxing
● An explicit conversion from an object (or interface) back to a value type.
● The process involves checking that the object is a correctly boxed value type.
● The value is then copied from the object on the heap to a value-type variable on the stack.
3. Why Boxing and Unboxing Are Used
●
They allow a unified view of the type system, enabling any value type to be treated as a
reference type, or object.
● This capability is fundamental in C# and other .NET languages to interact with the common
base object type.
4. Example1:-
using System;
class Program
// Value type
Output:
Boxed value: 10
Unboxed value: 10
Assignment 2
2. Purpose
○ To display advertisements dynamically
○ To make the web page more interactive and professional.
<Advertisements>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<NavigateUrl>[Link]
<AlternateText>Example Ad</AlternateText>
<Impressions>10</Impressions>
<Keyword>Computers</Keyword>
</Ad>
</Advertisements>
7. Events of AdRotator
○ AdCreated → Raised when ad is created.
○ Init → When control is initialized.
○ Load → When control is loaded.
○ PreRender → Before rendering.
○ Unload → When removed from memory.
8. Working of AdRotator
○ Reads ads from the XML file.
○ Randomly selects one ad based on the Impressions.
○ Displays the selected ad with its link on the web page.
9. Features
○ Supports random and weighted ad display.
○ Allows keyword-based filtering.
○ Simple to implement using XML.
10. Advantages
○ Easy to update advertisements.
○ No coding required, only XML maintenance.
○ Enhances the web page look and feel.
11. Limitations
○ Requires maintaining an external XML file.
○ Best for small to medium advertisement needs, not large-scale systems.
Q2. Dropdown List vs ListBox in [Link]
2. Definition of ListBox
3. Comparison Table
Definition Displays a compact dropdown menu Displays a box containing a list of items
where only one item is visible at a time. with multiple rows visible.
Space Requires less space, as it shows only the Requires more space since multiple
Requirement selected item until expanded. items are always visible.
Scrolling Dropdown expands when clicked; no Scrollbar may appear if there are many
scrollbar needed for small lists. items.
User User must click to open dropdown and User can directly view and select from
Interaction then select. visible items.
Advantages Compact, saves space, simple to use. Supports multiple selection, displays
more items at once.
Limitations Cannot allow multiple selections. Occupies more screen space, less
compact.
Q3. Site map path Control in [Link] (not so much important but important)
1. Definition
○ The SiteMapPath control in [Link] is a navigation control used to display the
hierarchical path (also known as a breadcrumb) of the current web page.
○ It helps users understand their location within a website and easily move back to parent
pages.
2. Purpose
○ Provides a breadcrumb trail (e.g., Home > Products > Electronics > Mobile).
○ Enhances user navigation and website usability.
3. Data Source
○ It works with a SiteMapDataSource, which reads information from the [Link]
file.
○ The sitemap defines the structure of the website (pages and hierarchy).
4. [Link] File
Example:
<siteMap>
</siteMapNode>
</siteMapNode>
</siteMap>
6. Properties of SiteMapPath
○ PathDirection → Order of display (RootToCurrent or CurrentToRoot).
○ PathSeparator → Symbol/text used between nodes (default is ">").
○ ParentLevelsDisplayed → Number of parent nodes displayed.
○ SkipLinkText → Specifies text for accessibility skip link.
○ SiteMapProvider → Defines which sitemap provider is used.
7. Events
○ ItemCreated → Raised when an item in the path is created.
○ ItemDataBound → Raised when data binding occurs for a node.
8. Example Usage
1. RequiredFieldValidator
● Ensures that the user does not leave a field blank.
● Used for mandatory fields like Username, Password, Email.
● Properties: ControlToValidate, ErrorMessage, Text.
● Example:
2. CompareValidator
● Compares the value entered in a control with another control or a fixed value.
● Commonly used to compare password and confirm password fields.
● Properties:
○ ControlToValidate
○ ControlToCompare
○ Operator (Equal, GreaterThan, LessThan)
○ Type (String, Integer, Date, Currency)
● Example:
3. RangeValidator
● Checks whether the input value lies within a specified minimum and maximum range.
● Can be used for validating age, marks, price, date ranges etc.
● Properties: MinimumValue, MaximumValue, Type.
● Example:
4. RegularExpressionValidator
● Ensures that the input value matches a given regular expression (pattern).
● Used for validating email ID, phone numbers, postal codes, etc.
● Example:
10. Conclusion
Validation controls in [Link] are essential for ensuring data correctness in web applications. They
provide ready-made solutions like RequiredFieldValidator, CompareValidator, RangeValidator,
RegularExpressionValidator, CustomValidator, and ValidationSummary. By using them effectively,
developers can build secure, user-friendly, and error-free web applications.
2. Purpose
○ To perform immediate actions when the user changes a selection or enters data.
○ Commonly used in controls like DropDownList, RadioButtonList, CheckBox,
TextBox.
3. How It Works
○ When the value of a control changes, the page is submitted (posted back) to the server.
○ The server processes the event and refreshes the page with updated output.
4. Syntax
5. Example
7. Events Triggered
○ TextBox → TextChanged event
○ DropDownList → SelectedIndexChanged event
○ RadioButtonList → SelectedIndexChanged event
○ CheckBox → CheckedChanged event
8. Advantages
○ Provides real-time response to user input.
○ Useful for cascading dropdowns (e.g., Country → State → City).
○ Reduces need for a separate “Submit” button in some cases.
9. Limitations
○ Causes frequent page reloads, which may reduce performance.
○ Increases server load if used unnecessarily.
○ May not give smooth user experience (flickering) without AJAX.
10. Conclusion
● The AutoPostBack property is a powerful feature in [Link] for immediate server-side
processing.
● It should be used wisely — only when instant feedback is required, otherwise it may impact
performance.
Q6. Life Cycle of an [Link] Page
1. Definition
o The Page Life Cycle in [Link] defines the sequence of events, methods, and stages
that occur from the time a page is requested by a user until it is rendered in the
browser and unloaded from memory.
o Understanding the life cycle helps developers write code at the correct stage (e.g.,
initializing controls, handling events, saving data).
2. Stages of [Link] Page Life Cycle
1. Page Request
· The cycle begins when a page is requested by the user.
· [Link] decides whether the page can be served from cache or needs to be
processed.
2. Start Stage
· Page properties such as Request, Response, IsPostBack, and UICulture are set.
· Determines whether it’s a first-time request or a postback.
3. Page Initialization (Init Event)
· Each control on the page is initialized and assigned a unique ID.
· Theme and master page settings are applied.
· Controls do not yet contain user values.
4. Load View State
· [Link] loads the saved view state (previous values of controls).
· Maintains control values across postbacks.
5. PostBack Data Processing
· If the request is a postback, data entered by the user is restored to the controls.
6. Page Load (Load Event)
· Controls are loaded with their default or restored values.
· Code inside the Page_Load event runs at this stage.
7. PostBack Event Handling
· If the request is a postback, specific events are handled:
o Button Click → OnClick()
o TextBox Change → OnTextChanged()
o DropDownList Change → OnSelectedIndexChanged()
8. PreRender
· Final changes are made to the page or controls before rendering.
· Last chance to modify data.
9. Save State (SaveViewState)
· The current values of controls are saved into ViewState to be used in the next
postback.
10. Render
·The page and controls generate their HTML output.
· The HTML is sent to the client’s browser for display.
11. Unload
· The page is unloaded from memory.
· Cleanup tasks are performed (closing database connections, releasing resources).
3. Diagram (Conceptual Flow)
5. Conclusion
● The [Link] Page Life Cycle consists of multiple well-defined stages.
● Developers must place their code at the appropriate stage (e.g., initialization code in Init,
event-handling in Load, cleanup in Unload) to build efficient and reliable web applications.
Assignment 3
1. Exception handling
Answer
1. A cookie is a small piece of information sent from a server to a user's web browser and
stored by the browser.
2. They are used for state management, such as remembering user preferences,
authenticating users, or storing a shopping cart's contents.
3. The key mechanism for working with cookies is the HttpRequest object for reading and the
HttpResponse object for writing.
i . Creation
There are two primary ways to create or write a cookie in [Link].
- Method 1: Using the HttpCookie class
● This method involves explicitly creating an instance of the HttpCookie class, setting its
properties, and then adding it to the [Link] collection.
● State management is the process of maintaining data and user information across
multiple requests within a web application.
● It is necessary because the HTTP protocol, which web applications are built upon, is
fundamentally "stateless," meaning it does not remember previous user interactions.
● Advantages of State Management
○ Reduced Server Load – Client-side storage frees up server memory.
○ Supports Web Farms – State can be maintained even when requests are
handled by multiple servers.
○ Faster Performance – Less pressure on the server improves response time.
○ Persistent Data – Data can be carried across different pages of an application.
○ Flexibility – Developers can choose between client-side and server-side
methods.
○ User Convenience – Saves user input, avoiding repeated data entry.
1. In [Link] Web Forms, navigation controls are a set of server controls that allow you
to create and manage navigation menus, breadcrumbs, and hierarchical tree views.
2. They typically work with a [Link] file to define the website's structure, which
simplifies maintenance and ensures consistency.
3. Types of navigation controls
i. Menu control
● Definition: This control displays a standard, hierarchical menu for navigation. It
can present links in either horizontal or vertical orientation and supports both
static and dynamic (fly-out) menu items.
● Properties:
○ Items → Collection of menu items (each item can have text, link, and
child items).
○ Orientation: Specifies how the menu is displayed: Horizontal (top
navigation) or Vertical (side navigation).
○ StaticDisplayLevels: Defines how many menu levels should always
remain visible without expanding.
○ MaximumDynamicDisplayLevels: Defines how many submenu levels
can be displayed dynamically..
○ SelectedItemStyle : Sets style for the currently selected menu item.
○
ii. SiteMapPath control
● The SiteMapPath control shows the navigation path (breadcrumb trail) from the
home page to the current page.
● Example: Home > Products > Electronics > Mobile.
● Properties:
○ PathSeparator : Character or symbol used between links (default: ">").
○ ParentLevelsDisplayed: Number of parent levels to display (example:
only last 2 levels).
○ CurrentNodeStyle: Style (bold, underline, color) for the last node
(current page).
○ NodeStyle: Style for breadcrumb nodes that are not currently selected.
○ RootNodeStyle: Style for the root (first) node, usually "Home".
○ RenderCurrentNodeAsLink : If set to true, the current page will also be
clickable.
iii. TreeView control
6. Performance Takes more time due to server Faster since it does not
communication but ensures need to contact the
secure and accurate processing. server for every
operation.
8. Example Code inside <% %> or event Code using <script> tag
([Link] C#) handlers like Button_Click() or JavaScript runs on
runs on the server. the browser.
10. Use Case Used for authentication, Used for form validation,
database CRUD operations, and animations, dynamic UI
business logic. updates, etc.
Assignment 4
Q1. Grid View(templates ,example - sorting paging,features )
Answer :-
1. Definition:
The GridView control in [Link] is used to display, edit, delete, and sort data in a
tabular form where each column represents a field and each row represents a record
from the data source.
2. Data Binding:
GridView can be easily bound to data source controls like SqlDataSource,
ObjectDataSource, or AccessDataSource, allowing automatic display of data from
databases.
3. Main Features:
It supports built-in functionalities such as sorting, paging, updating, deleting, and
row selection without writing complex code.
4. Customizable Appearance:
GridView appearance can be customized using themes, styles, colors, and borders to
enhance the UI design.
5. Important Properties:
9. Types of Templates:
Importance:
Data Binding simplifies creation of data-driven web applications, allowing developers to
connect UI and database easily with minimal code
4. Structure Can store multiple tables with Reads data from a single result set at a
relationships and constraints. time.
5. XML and Supports XML operations and No XML or caching support — reads
Caching data caching, allowing offline live data only.
work.
9. Preferred Best when working with Best for fast reading of large result
Use Case multiple tables and performing sets without editing.
data updates.
Answer:-
Assignment 5
[Link] Architecture
[Link] (ActiveX Data Object .NET) is a data access technology provided by Microsoft that allows
interaction between an application and different data sources such as SQL Server, Oracle, MySQL, etc.
It provides a bridge between the front-end application and the back-end database using various
objects.
1. Connection
● The Connection object is the first and most important component of [Link].
It is used to connect your application to the backend database (such as SQL Server,
Oracle, or MySQL).
● To create a connection, you need two key details:
○ Database location: The machine name, IP address, or server name where the
database is hosted.
○ Security credentials: Authentication details, which can be Windows
Authentication or username and password based.
● Without a connection object, communication with the database is not possible
2. Command
● The Command object is used to execute SQL queries or stored procedures against the
connected database.
● You can use it to:
○ Retrieve data from the database.
○ Insert, update, or delete records.
● The command is executed over the established connection and helps in interacting
directly with the database using SQL statements.
3. DataReader
4. DataSet
● The DataSet is a disconnected record set that can hold multiple tables of data in
memory.
● It allows forward and backward navigation through data.
● Since it is disconnected, it does not require a continuous connection to the database.
● You can also modify data within the DataSet and later update the database with the
changes.
● The DataSet is filled by the DataAdapter.
5. DataAdapter
● The DataAdapter acts as a bridge between the Command object and the DataSet.
● It is responsible for:
○ Executing the command to fetch data from the database.
○ Filling the DataSet with the data obtained from the command.
● It also helps in updating the database with changes made in the DataSet.
6. DataView
● The DataView provides different views of the data stored in a DataTable (which is part
of a DataSet).
● It allows:
○ Sorting and filtering data dynamically.
Creating customized views based on certain conditions or filter expressions.
● It is very useful in data-binding applications where the same data needs to be displayed
in multiple formats.
Definition:
A Data Source Control connects data-bound controls (like GridView or DropDownList) to
data sources (like SQL, XML, or objects) and simplifies data binding operations such as select,
insert, update, delete, and sort.
SqlDataSource Control
Example:
Summary
Data Source Controls make data operations simple, fast, and code-free by linking data
sources to UI controls directly.
They hide complex binding logic and are widely used in [Link] web applications.
Assignment 5
Q1. AJAX (ScriptManager, UpdatePanel, Timer – Advantages and
Disadvantages, Script Management)
Answer
1. Definerition
2. Purpose of AJAX
1. AJAX uses the XMLHttpRequest object to send and receive data from the server in
the background.
2. When a request is made:
● Acts as the main controller for all AJAX operations on the page.
● Loads the Microsoft AJAX Library and manages partial postbacks (i.e., updates only
a portion of the page).
● Every [Link] page using AJAX must have one ScriptManager control.
Example:
● Functions of ScriptManager:
- Registers and manages scripts used for asynchronous communication.
- coordinates between server-side and client-side scripts.
- Ensures proper functioning of controls like UpdatePanel and Timer.
● Defines a region of the page that can refresh independently without reloading the entire
page.
● Controls placed inside its <ContentTemplate> section can trigger partial page updates.
● Supports properties like:
○ UpdateMode: Controls when the panel updates (Always/Conditional).
○ ChildrenAsTriggers: Defines whether child controls inside the panel can trigger
updates.
Example:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime" runat="server" />
<asp:Button ID="btnShow" runat="server" Text="Show Time" />
</ContentTemplate>
</asp:UpdatePanel>
● The Timer control triggers postbacks automatically after a fixed time interval.
● The time interval is set using the Interval property (in milliseconds).
● When used with an UpdatePanel, it allows automatic and periodic updates for that
specific section — useful for real-time applications like clocks, stock prices, and
dashboards.
Example:
Together, these three controls allow dynamic, real-time, and fast updates without reloading
the full page.
● AJAX supports Partial Page Rendering (PPR) — only a selected section (inside
UpdatePanel) of the page refreshes.
● This reduces flicker, improves speed, and enhances the overall user experience.
7. Advantages of AJAX
1. Improved Performance:
Only specific parts of the page update, reducing unnecessary data transfer.
2. Reduced Server Load:
As fewer requests are made, the server handles lighter workloads.
3. Better User Experience:
Web applications feel faster and smoother, similar to desktop apps.
4. Maintains Page State:
No full reload means form inputs and other states remain unchanged.
5. Real-Time Updates:
Ideal for live data applications (e.g., chat apps, clocks, notifications).
8. Disadvantages of AJAX
1. Definition:
Impersonation in [Link] allows the web application to run under the Windows
identity of the user making the request (or another specified account) instead of the
default [Link] process identity.
2. Default Behavior:
By default, impersonation is disabled using <identity impersonate="false" />, so the
application runs under the [Link] process account such as NetworkService or
ApplicationPoolIdentity.
3. Purpose:
It is used when an application must access files, network shares, or databases on
behalf of the authenticated user instead of the application’s own identity.
4. How It Works:
When enabled, [Link] executes code under the user’s identity authenticated by
IIS.
The process identity remains the same for configuration tasks, but the thread runs as the
impersonated user.
5. Use Cases:
○ To access restricted resources like files or databases using the user’s own
credentials.
○ For auditing and logging, ensuring logs show the real user instead of a generic
service account.
○ In intranet applications where Windows authentication is used.
6. Advantages:
○ Provides fine-grained security control based on user identities.
○ Supports auditing and traceability across systems.
○ Allows simpler access control using existing Windows permissions (ACLs).
7. Disadvantages:
○ Reduces scalability and performance due to separate connections per user.
○ Adds complexity in managing many user identities and permissions.
○ Increases security risks if credentials are mishandled or over-privileged.
9. Best Practices:
○ Use impersonation only when necessary.
○ Grant impersonated accounts minimum privileges.
○ Store credentials securely if a specific user is used.
○ Monitor impersonation activity for compliance and auditing.
[Link]
Answer:-
1. Introduction
- NuGet maintains a central repository ([Link]) with over 100,000 public packages.
Developers can also host packages privately:
○ On Azure DevOps or other cloud servers.
○ On a private network.
○ On a local file system.
- This allows sharing of packages only with authorized users within an organization.
5. NuGet Tools
NuGet provides several tools to create, install, manage, and publish packages.
.NET CLI A command-line interface for .NET Core and .NET Standard
projects. It allows automation in workflows and works outside
Visual Studio.
[Link] CLI A standalone CLI for managing .NET Framework libraries. It
helps both package creators (nuget pack) and consumers (nuget
install).
Package Manager A simple graphical interface in Visual Studio for adding and
UI managing NuGet packages.
MSBuild Allows users to restore and create NuGet packages directly from
the build tool chain.
[Link] vs Authorization
Answer
Authentication Authorization
It needs usually the user's login It requires the user’s privileges or security
details. levels.
The OpenID Connect (OIDC) The OAuth 2.0 protocol governs the
protocol is an authentication protocol overall system of user authorization
that is generally in charge of user process.
authentication process.
The authentication credentials can be The authorization permissions cannot be
changed in part as and when required changed by user as these are granted by
by the user. the owner of the system and only he/she
has the access to change it.
The user authentication is visible at The user authorization is not visible at the
user end. user end.
Introduction:
Bootstrap is a free, open-source front-end framework used to design responsive and mobile-
first websites quickly. It provides ready-to-use CSS classes, JavaScript components, and
layout utilities that simplify web development.
Features of Bootstrap:
1. Responsive Design:
Bootstrap is mobile-first, meaning it automatically adjusts the layout according to the
device screen size.
4. JavaScript Plugins:
Bootstrap includes plugins for interactivity (e.g., modals, dropdowns, tooltips,
popovers) which rely on jQuery.
5. Grid System:
Offers a 12-column flexible grid system to create responsive page layouts easily.
6. Cross-Browser Compatibility:
Works seamlessly across all modern browsers.
7. Customizable:
Developers can customize Bootstrap by modifying variables or choosing specific
components.
<link rel="stylesheet"
href="[Link]
<script src="[Link]
Note: jQuery is required for Bootstrap JavaScript plugins but not for using CSS
classes.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
</body>
</html>
2. Containers:
<div class="container">
<h1>My First Bootstrap Page</h1>
<p>This is some text.</p>
</div>
<div class="container-fluid">
<h1>My First Bootstrap Page</h1>
<p>This is some text.</p>
</div>
Forms in Bootstrap:
<form>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" placeholder="Enter Name">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Typography in Bootstrap:
● Paragraphs: <p>
● Classes for emphasis: .lead for important text, .text-muted, .text-primary,
.text-success, .text-danger
● Alignment: .text-left, .text-center, .text-right
Example: