Unit 1
1. Dot Net framework architecture in AWP
The .NET Framework is a software development platform developed by Microsoft. It provides a
controlled environment for developing and running applications on Windows. The architecture of
the .NET Framework can be understood in layers.
.NET Framework Architecture in [Link] Web
Applications
1. Common Language Runtime (CLR)
o Executes .NET code and manages memory, security, and exceptions.
o Supports multiple languages via Common Type System (CTS).
2. Base Class Library (BCL)
o Provides pre-built classes for file handling, collections, networking, XML, and
database access.
3. Assemblies
o Compiled units of code (DLL/EXE) containing metadata, MSIL, and manifest.
4. Application Domains
o Isolated environment for running apps, providing security and process isolation.
o [Link] apps run in Web App Domains hosted by IIS.
[Link] Web Application Layers
Presentation Layer: UI components (Web Forms, MVC, Razor).
Business Logic Layer: Application rules and logic.
Data Access Layer: Database interaction using [Link] / Entity Framework.
Hosting Layer: IIS handles HTTP requests → [Link] Runtime → CLR.
Flow:
Browser → IIS → [Link] Runtime → CLR → Application Code
2. Short Note on type casting
Type casting is converting a variable from one data type to another. In [Link], it’s
commonly used to handle user input, query strings, session variables, and database values.
Types of Type Casting
1. Implicit Casting (Automatic)
o Small type → Larger type (safe).
o Example:
o int num = 10;
o double d = num; // int → double
2. Explicit Casting (Manual)
o Larger type → Smaller type (may lose data).
o Example:
o double d = 9.78;
o int num = (int)d; // double → int
3. Using Convert / Parse
o Common in web apps for converting strings to numbers or booleans.
o Example:
o string input = [Link];
o int quantity = Convert.ToInt32(input);
o int price = [Link]([Link]["price"]);
Key Points
Implicit = automatic, safe.
Explicit = manual, may lose data.
Use Convert / Parse for web form or query string values.
3. Short Note on delegates
Definition:
A delegate is a type-safe reference to a method. It allows methods to be passed as parameters
and invoked dynamically at runtime.
Key Features
Type-safe: Only methods with matching signature can be assigned.
Supports events and callbacks: Essential for [Link] event handling.
Can reference: Both static and instance methods.
Syntax Example
// Declare a delegate
public delegate void Notify(string message);
// Method matching delegate signature
public void ShowMessage(string msg)
{
[Link](msg);
}
// Using the delegate in [Link]
Notify notify = new Notify(ShowMessage);
notify("Button clicked successfully!");
Uses in [Link] Web Applications
Event Handling: e.g., [Link] events.
Callbacks: For asynchronous operations or notifications.
Dynamic Method Invocation: Passing methods as parameters to other methods or
classes.
4. Assembly and its types
An assembly is a compiled code library in .NET that contains MSIL, metadata, and manifest.
It is the basic unit of deployment, versioning, and security.
Components
Manifest: Assembly metadata (name, version, references).
Metadata: Info about types, methods, and references.
MSIL: CPU-independent code executed by CLR.
Resources: Embedded files like images or strings.
Types of Assemblies
1. Private Assembly – Used by a single application; stored in the application folder.
2. Shared Assembly – Can be used by multiple applications; stored in GAC; requires a
strong name.
3. Satellite Assembly – Contains localized resources for different languages; supports
globalization.
Key Points:
Private → single app
Shared → multiple apps
Satellite → localization
5. Explain the concept of boxing and unboxing
Boxing is the process of converting a value type (like int, float, struct) into a reference
type (object or interface type). This allows the value type to be treated as an object. When a
value type is boxed, a copy of its value is wrapped inside an object and stored on the heap.
Example of Boxing:
int num = 50; // value type
object obj = num; // boxing
Unboxing is the reverse process, where the value type is extracted from the object. This requires
an explicit cast to the original value type.
Example of Unboxing:
int n = (int)obj; // unboxing
Key Points:
Boxing is implicit; unboxing is explicit.
Boxing moves data from stack → heap; unboxing moves it back heap → stack.
Useful when value types need to be stored in collections that work with objects.
Unit 2
1. Write a short note on page class
Definition: The Page class is the base class for all [Link] web pages (.aspx) and is
part of the [Link] namespace.
Purpose: It manages the page lifecycle, handles events, and provides access to server
controls, state management, and HTTP request/response.
Key Points:
1. Handles Init, Load, PreRender, Unload events.
2. Supports ViewState, Session, Cookies for state management.
3. Methods like [Link]() and [Link]() for output and
navigation.
Example:
public partial class Default : [Link]
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
[Link]("Welcome to [Link] Web Page!");
Summary: The Page class is essential for creating dynamic web pages and managing their
lifecycle and state efficiently.
2. Functionality of web control like radio button, text box, checkbox
1. TextBox
Purpose: Allows the user to input text data (like name, email, or password).
Key Features:
o Single-line or multi-line input.
o Can mask input for passwords.
o Can validate user input using validation controls.
Example Usage:
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
2. RadioButton
Purpose: Allows the user to select one option from a group of choices.
Key Features:
o Radio buttons with the same GroupName work together so only one can be
selected.
o Can trigger server-side events when selected.
Example Usage:
<asp:RadioButton ID="rdoMale" runat="server" GroupName="Gender"
Text="Male" />
<asp:RadioButton ID="rdoFemale" runat="server" GroupName="Gender"
Text="Female" />
3. CheckBox
Purpose: Allows the user to select one or more options independently.
Key Features:
o Can be checked or unchecked.
o Can be used individually or as a group.
o Can trigger server-side events on checking/unchecking.
Example Usage:
<asp:CheckBox ID="chkAgree" runat="server" Text="I agree to terms" />
3. Explain validation control
Validation controls in [Link] ensure that user input is correct and complete before
submission. They help maintain data integrity and improve user experience.
Types of Validation Controls
1. RequiredFieldValidator – Ensures the field is not left empty.
2. CompareValidator – Checks data type or compares values of two fields.
3. RangeValidator – Ensures input falls within a specified range.
4. RegularExpressionValidator – Validates input matches a pattern (like email or
phone).
5. CustomValidator – Allows custom server-side or client-side validation.
6. ValidationSummary – Shows a list of all validation errors on the page.
Example (RequiredFieldValidator)
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvName" runat="server"
ControlToValidate="txtName" ErrorMessage="Name is required!"
ForeColor="Red"></asp:RequiredFieldValidator>
Key Points
Validation can be client-side (immediate) or server-side (secure).
Prevents incorrect data submission.
Provides error messages for better user guidance.
4. Web site navigation control
Navigation controls help users move easily through a website. They are server-side controls in
[Link] and can be linked to a site map.
Types:
1. Menu Control – Displays a horizontal or vertical menu of pages. Can be bound to
SiteMapDataSource.
2. TreeView Control – Shows hierarchical structure in a collapsible tree format.
3. SiteMapPath (Breadcrumb) – Displays the current page’s path in the site hierarchy.
4. HyperLink / HyperLinkButton – Individual links for navigation between pages.
Features:
Dynamic data binding with site map
Hierarchical display of pages
Improves user experience with easy navigation
Example:
<asp:Menu ID="Menu1" runat="server"
DataSourceID="SiteMapDataSource1"></asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
5. Explain the concept of page directive, code section and page layout in AWP
1. Page Directive:
o A special instruction at the top of an [Link] page (<%@ Page %>) that tells the
compiler how to process it.
o Specifies language, code-behind file, class inheritance, master page, etc.
o Example: <%@ Page Language="C#" AutoEventWireup="true"
CodeFile="[Link]" Inherits="_Default" %>
2. Code Section (Code-behind):
o Contains server-side logic in a separate .[Link] file.
o Handles events like Page_Load or button clicks and interacts with controls or
databases.
o Example:
protected void Page_Load(object sender, EventArgs e) { [Link] =
"Welcome!"; }
protected void btnClick_Click(object sender, EventArgs e) { [Link] =
"Clicked!"; }
3. Page Layout:
o Defines the structure and display of content using HTML, CSS, and server
controls.
o Includes form, labels, buttons, and optional master page for consistent design.
o Example:
<form runat="server">
<asp:Label ID="lblMessage" runat="server" />
<asp:Button ID="btnClick" runat="server" Text="Click Me"
OnClick="btnClick_Click" />
</form>
Summary:
Directive → page configuration
Code section → server-side logic
Layout → visual structure and controls
6. Treeview Control, Sitemap control
TreeView Control in AWP
Displays hierarchical data in a tree structure (parent-child nodes).
Supports expand/collapse, selection, and navigation.
Can be populated manually or dynamically from XML/Database.
Example:
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode Text="Home" NavigateUrl="~/[Link]" />
<asp:TreeNode Text="Products">
<asp:TreeNode Text="Electronics"
NavigateUrl="~/[Link]" />
</asp:TreeNode>
</Nodes>
</asp:TreeView>
Sitemap Control in AWP
Displays website navigation using a [Link] file.
Works with SiteMapDataSource to auto-generate menus.
Easy to maintain: reflects site changes automatically.
Example:
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1" />
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
Difference
TreeView: Can show any hierarchical data; manual updates.
Sitemap: Shows site navigation; updates automatically from sitemap file.