Assignment 4-5 Awp
Assignment 4-5 Awp
• Multiple Catch Statements: Allow handling different types of exceptions separately within
the same try-catch block.
• The order matters: more specific exceptions should be placed before more general ones.
• Example:
csharp
Copy code
try
• This helps in giving a customized error message for different types of exceptions.
• Exception Handling: A way to manage runtime errors so the application doesn’t crash
unexpectedly.
• try-catch-finally:
o try: The block where you write the code that might cause an error.
o catch: Catches the exception and handles it. Multiple catch blocks can be used for
different exception types.
o finally: An optional block that runs whether an exception occurs or not, used for
cleanup activities.
• throw: Used to explicitly raise an exception.
• Example:
csharp
Copy code
try
finally
Console.WriteLine("Execution completed.");
• Web applications are stateless by default; the server does not remember anything between
requests.
• Reasons to Implement:
o To retain user information across different pages (like user login data).
• Query String: A way to pass data between web pages through the URL.
• Data is sent as key-value pairs in the URL after the question mark (?), and multiple pairs are
separated by &.
• Example:
o URL: http://example.com/page.aspx?name=John&age=30
o This URL passes the values John and 30 for the keys name and age, respectively.
• Advantages:
• Disadvantages:
• Each user gets a unique session ID, which is used to track their data across multiple requests.
• Example:
csharp
Copy code
Session["UserName"] = "John";
• Advantages:
• Disadvantages:
• CSS (Cascading Style Sheets): A language used to style HTML elements. It controls the look
and feel of a webpage, such as layout, colors, fonts, and spacing.
• Advantages:
o Separation of Content and Design: Keeps HTML code cleaner and easier to maintain.
• Disadvantages:
7) Give the uses of Master Pages and explain how Master Pages work.
o A master page defines a common template, including layout and shared elements
like headers and footers.
o Content pages use the master page and fill in the specific content where
placeholders are defined.
o Changes to the master page affect all content pages using it, making updates easy.
• Example:
html
Copy code
</asp:Content>
• Hierarchy of Exceptions: In C#, exceptions are organized in a hierarchy where all exception
types derive from the base class System.Exception.
• Key Classes:
o Common Exceptions:
▪ DivideByZeroException
▪ NullReferenceException
▪ IndexOutOfRangeException
▪ ArgumentException
• Hierarchy helps in catching specific exceptions first and then more general ones, providing
fine-grained error handling.
ASSIGNMENT-5
1) What is a database and what are its uses?
• Database: An organized collection of data that can be easily accessed, managed, and
updated.
• Uses:
o Data Security: Protects sensitive information using access control and encryption.
o Reporting and Analysis: Provides a foundation for generating reports and data
analysis.
o Supports Multiple Users: Multiple users can access and modify data concurrently.
• Conversion in C#: The process of changing a variable from one data type to another.
• Types of Conversion:
o Explicit Conversion (Casting): Required when there is a possibility of data loss (e.g.,
float to int).
• Example:
csharp
Copy code
• GridView: A web control in ASP.NET used for displaying, sorting, and editing tabular data.
• Features:
o Data Editing: Users can edit, delete, or update rows directly in the GridView.
o Binding with Data Sources: Easily binds with databases, XML files, or other data
sources.
• Example:
html
Copy code
</asp:GridView>
• SQL Data Provider: A set of classes in ADO.NET for accessing and working with data from SQL
Server.
• Components:
• Usage:
• Example:
csharp
Copy code
• Partial Request: A technique in ASP.NET to update parts of a web page without reloading the
entire page, enhancing user experience.
• UpdatePanel: A control used to define the sections of a page that should be updated during
a partial request.
• How it Works:
• Example:
<asp:UpdatePanel runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
• Types:
• Example:
xml
Copy code
<authorization>
</authorization>
• XML (eXtensible Markup Language): A text-based format for storing and transporting data.
• Uses:
o Organizes data in a hierarchical structure using custom tags.
• Improving Listing:
o Apply XSLT to transform XML data into different formats like HTML.
• Example XML:
xml
Copy code
<Employees>
<Employee>
<Name>John</Name>
<Age>30</Age>
</Employee>
</Employees>
• How it Works:
o The server validates the credentials and creates an authentication ticket if valid.
o The ticket is stored in a cookie, enabling the user to access protected resources.
• Configuration:
• Example:
xml
Copy code
<authentication mode="Forms">
</authentication>
• How it Works:
o Allows the web page to send and receive data from the server without refreshing the
entire page.
o The server responds with data, which can be updated on the page without reloading.
• Advantages:
• Example:
javascript
Copy code
xhr.send();