ASP.NET Important Questions
1. What is event bubbling?
As the
child control send events to parent it is
termed as event bubbling.
Explanation.
Server controls like Data grid, Data List, and Repeater can have
other child controls inside them.
Example Data Grid can have combo box
inside data grid.
These child control do not raise there events by
themselves, rather they pass the event to the container parent (which
can be a data grid, data list, repeater),
which passed to the page as
“
ItemCommand” event.
2.How many types of validation controls are provided by ASP.NET?
There are
six main types of validation controls:-
1.RequiredFieldValidator
checks - control
have any value.(control should not be empty.)
2.RangeValidator
checks- value in validated control is in that
specific range. ( TextBox Value < eight lengths).
3.CompareValidator
checks - value in controls should
match some specific value. (Textbox TxtPie should be equal to 3.14.)
4. RegularExpressionValidator
control value should match with a
specific regular expression.
5. CustomValidator
It is used to define
User Defined validation.
6. Validation Summary
It
displays summary of all current
validation errors on an ASP.NET page.
Note: - It is rare that some one will ask step by step all the
validation controls. Rather they will ask for what type of validation
which validator will be used. Example in one of the interviews i was
asked how will you display summary of all errors in the validation
control...just uttered one word Validation summary.
3.Explain “AutoPostBack”?
If we want the control to automatically post back in case of any event, we will need to check this attribute as true.
4. Enable automatic paging in Data Grid?
Following are the points to be done in order to enable paging in Data grid:-
• Set the “Allow Paging” to true.
• In PageIndexChanged event set the current page index clicked.
5. What is the difference between “Web.config” and “Machine.Config”?
“
Web.
config” files apply settings to
each web application, while
“
Machine.
config” file apply settings to
all ASP.NET applications.
6. What is a SESSION and APPLICATION object?
Session object store information
between HTTP requests for a
particular user,
while
application object are
global across users.
7. How do we assign page specific attributes?
Page attributes are specified using the
@Page directive.
8. What is the use of @ Register directives?
@Register directive informs the
compiler of
any custom server control added to the page.
9.How can we create custom controls in ASP.NET and use of @ Register directive?
User controls are created using
.ASCX in ASP.NET.
After .ASCX
file is created you need to two things in order that the ASCX can be
used in project:.
•
Register the ASCX control in page using the
<%@ Register directive.
<%@ Register tag prefix="Accounting" Tag name="footer" Src="Footer.ascx" %>
• Now to use the above accounting footer in page you can use the below directive.
<Accounting: footer runat="server" />
9.What is .NET Reflection?
.NET Framework's Reflection API
allows you to fetch type (assembly)
information at
runtime programmatically.
We can also
achieve late
binding by using .NET Reflection.
It enables you to use code that is not available at compile time.
.NET
Reflection allows an application to collect information about itself and
also to manipulate on itself.
It can be used effectively to
find all
types in an assembly and/or
dynamically invoke methods in an
assembly.
Using Reflection, you can get any kind of information which you can
see in a class viewer; for example, information on the methods,
properties, fields, and events of an object.

The
System.Reflection namespace and the
System.Type
class plays a very important role in .NET Reflection. These two work
together and allow you to reflect over many other aspects of a type.
10. What is "Late Binding/dynamic invocation"?
Late binding is a powerful technology in .NET
Reflection which allows you to create an instance of a given type and
invoke its members at runtime without having compile-time knowledge of
its existence;.
This technique is useful only when working with an object which is not
available at compile time.
It
is very important to take the right decision when to call and use and
when not to use this because of performance issues.
Using this technique
has an impact on the performance of your application.
10. What is JIT? What is NGEN? What are limitations and benefits of each?
JIT stands for Just in time compiler it compiles code into native code to execute by processor in three different techniques.
It compiles code just before code required to be run which makes execution little slow (depends)
so to avoid that we use NGEN
which converts IL into native code like JIT but during deployment.
It comes with large image which also includes that codes compiled version which is not being calling frequently.
11. Why do you use the App_Code folder in ASP.NET?
The App_Code folder is automatically present in the project.
It stores the files, such as classes, typed data set, text files, and reports.
Only one dll is created for the complete folder, irrespective of how many files it contains.
12. What is an ASP.NET Web Form?
ASP.NET Web forms are designed to use controls and features that are almost as powerful as the ones used with Windows forms, and so they are called as Web forms.
The Web form uses a server-side control that are executed on the server and are rendered as HTML on the client.
13. What is Query String? What are its advantages and limitations?
It helps in sending the page information to the server.
Advantages:
Every browser works with this and does not require server resources and processing power.
Limitations:
Limited No of Characters : since it is used in the URL.
Security Threat : info visible to user in the URL.
14. What is the difference between authentication and authorization?
Authentication verifies the identity of a user .
Authorization is a process where you can check whether or not the identity has access rights to the system.
( procedure of granting access of particular resources)
15. Which ASP.NET objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.
16. Differentiate globalization and localization.
The globalization is a technique to
identify the specific part of a Web application
that is different for different languages
and make separate that portion from the core of the Web application.
The localization is a procedure of
configuring a Web application to be supported for a specific language or locale.
Which namespaces are necessary to create a localized application?
The System.Globalization and System.Resources namespaces are essential to develop a localized application.
17. Which method has been introduced in ASP.NET 4.0 to redirect a page permanently?
RedirectPermanent("/path/Name.aspx");
this Performs a permanent redirection from a requested URL to a specified URL.
18. What is the difference between the Response.Write() and Response.Output.Write() methods?
Response.Write() method allows you to write the normal output;
Response.Output.Write() method allows you to write the formatted output.
19. What is the default timeout for a Cookie?
30 minutes.
20. What are the events that happen when a client requests an ASP.NET page from IIS server?
- User requests for an application resource.
- The integrated request-processing pipeline receives the first user request.
- Response objects are created for each user request.
- An object of the HttpApplication class is created and allocated to the Request object.
- The HttpApplication class processes the user request.
21. Cookies.
How Cookies work.
The server tells the browser to put some files in a cookie, and the client then sends all the cookies for the domain in each request.
Large Cookies affect the network traffic.
What is a Cookie? Where is it used in ASP.NET?
Cookie
is a lightweight executable program, which the server posts to client
machines.
Cookies store the identity of a user at the first visit of the
Web site and validate them later on the next visits for their
authenticity.
The values of a cookie can be transferred between the
user's request and the server's response.
Explain the cookie less session and its working.
ASP.NET
manages the session state in the same process that processes the
request and does not create a cookie. It is known as a cookie less
session.
If cookies are not available, a session is tracked by adding a
session identifier to the URL.
The cookie less session is enabled using
the following code snippet:
<sessionState cookieless="true" />
How many types of Cookies are available in ASP.NET?
There are two types of Cookies available in ASP.NET:
- Session Cookie - Resides on the client machine for a single session until the user does not log out.
- Persistent Cookie - Resides on a user's machine for a period specified for its expiry, such as 10 days, one month, and never.
The user can set this period manually.
22. What are the event handlers that can be included in the Global.asax file?
Important event handlers:
- Application_Start
- Application_End
- Application_Error
- Session_Start
- Session_End
23. What is the difference between page-level caching and fragment caching?
Page-level caching, an entire Web page is cached;
Fragment caching, a part of the Web page, such as a user control added to the Web page, is cached.
24. Make a list of all templates of the Repeater control.
Contains following templates:
- ItemTemplate
- AlternatingltemTemplate
- SeparatorTemplate
- HeaderTemplate
- FooterTemplate
25. What is State Management? How many ways are there to maintain a state in .NET?State
management is used to
store information requests.
The state management
is
used to trace the information or data that affect the
state of the
applications.
There are two ways to maintain a state in .NET,
Client-Based state management and
Server-Based state management.
Client-Based state management:
- View State
- Hidden Fields
- Cookies
- Query Strings
- Control State
Server-Based state management:
- Application State
- Session State
- Profile Properties
26. What are the major built-in objects in ASP.NET?The major built-in objects in ASP.NET are as follows:
- Application
- Request
- Response
- Server
- Session
- Context
- Trace
27. Why do we need nested master pages in a Web site?
When we have several hierarchical levels in a Web site, then we use nested master pages in the Web site.
28. What is the appSettings Section in the web.config file?
The
web.config file
sets the configuration for a Web project.
The
appSettings block in configuration file
sets the user-defined values for the whole application.
29. Which data type does the RangeValidator control support?The
data types supported by the RangeValidator control are
Integer, Double, String, Currency, and
Date.
30. Difference between HTML and Web server controls?HTML controls are
client-side controls; therefore, all the validations for HTML controls are performed
at the client side.
Web server controls are
server-side controls; therefore, all the validations for Web server controls are
performed at the server side.
31. What do you understand by the culture?The culture denotes a combination of a
language and optionally a region or a country.
The contents of a Web page of a
multilingual Web site are
changed according to the culture defined in the
operating system of the user accessing the Web page.
What are the Culture and UICulture values?
Culture value determines the functions, such as Date and Currency,
which are used to format data and numbers in a Web page.
UICulture
value determines the resources, such as strings or images, which are
loaded for a Web page in a Web application.
What do you mean by a neutral culture?
When
you specify a language but do not specify the associated country
through a culture.
32. What is the use of the Global.asax file?The Global.asax file
executes application-level events and
sets application-level variables.