ASP.NET QUESTIONS
Describe
state management in ASP.NET.
State management is a technique to
manage a state of an object on different request.
The HTTP protocol is the fundamental
protocol of the World Wide Web. HTTP is a stateless protocol means every
request is from new user with respect to web server. HTTP protocol does not
provide you with any method of determining whether any two requests are made by
the same person.
Maintaining state is important in
any web application. There are two types of state management system in ASP.NET.
- Client-side state management
- Server-side state management
- Server-side state management
Explain
client side state management system.
ASP.NET provides several techniques
for storing state information on the client. These include the following:
- view state ASP.NET uses
view state to track values in controls between page requests. It works within
the page only. You cannot use view state value in next page.
- control state: You can
persist information about a control that is not part of the view state. If view
state is disabled for a control or the page, the control state will still work.
- hidden fields: It stores
data without displaying that control and data to the user’s browser. This data
is presented back to the server and is available when the form is processed.
Hidden fields data is available within the page only (page-scoped data).
- Cookies:Cookies are small
piece of information that server creates on the browser. Cookies store a value
in the user’s browser that the browser sends with every page request to the web
server.
- Query strings: In query
strings, values are stored at the end of the URL. These values are visible to
the user through his or her browser’s address bar. Query strings are not
secure. You should not send secret information through the query string.
Explain
server side state management system.
The following objects are used to
store the information on the server:
- Application State:
This object stores the data that is
accessible to all pages in a given Web application. The Application object
contains global variables for your ASP.NET application.
- Cache Object: Caching is the process of storing data that is used
frequently by the user. Caching increases your application’s performance,
scalability, and availability. You can catch the data on the server or client.
- Session State: Session object stores user-specific data between individual
requests. This object is same as application object but it stores the data
about particular user.
Explain
cookies with example.
A cookie is a small amount of data
that server creates on the client. When a web server creates a cookie, an
additional HTTP header is sent to the browser when a page is served to the
browser. The HTTP header looks like this:
Set-Cookie: message=Hello. After a
cookie has been created on a browser, whenever the browser requests a page from
the same application in the future, the browser sends a header that looks like
this:
Cookie: message=Hello
Cookie is little bit of text
information. You can store only string values when using a cookie. There are
two types of cookies:
- Session cookies
- Persistent cookies.
- Persistent cookies.
A session cookie exists only in
memory. If a user closes the web browser, the session cookie delete
permanently.
A persistent cookie, on the other
hand, can available for months or even years. When you create a persistent
cookie, the cookie is stored permanently by the user’s browser on the user’s
computer.
Creating cookie
protected void btnAdd_Click(object
sender, EventArgs e)
{
Response.Cookies[“message”].Value = txtMsgCookie.Text;
}
{
Response.Cookies[“message”].Value = txtMsgCookie.Text;
}
// Here txtMsgCookie is the ID of
TextBox.
// cookie names are case sensitive. Cookie named message is different from setting a cookie named Message.
// cookie names are case sensitive. Cookie named message is different from setting a cookie named Message.
The above example creates a session
cookie. The cookie disappears when you close your web browser. If you want to
create a persistent cookie, then you need to specify an expiration date for the
cookie.
Response.Cookies[“message”].Expires
= DateTime.Now.AddYears(1);
Reading Cookies
void Page_Load()
{
if (Request.Cookies[“message”] != null)
lblCookieValue.Text = Request.Cookies[“message”].Value;
}
// Here lblCookieValue is the ID of Label Control.
void Page_Load()
{
if (Request.Cookies[“message”] != null)
lblCookieValue.Text = Request.Cookies[“message”].Value;
}
// Here lblCookieValue is the ID of Label Control.
Describe
the disadvantage of cookies.
- Cookie can store only string
value.
- Cookies are browser dependent.
- Cookies are not secure.
- Cookies can store small amount of data.
- Cookies are browser dependent.
- Cookies are not secure.
- Cookies can store small amount of data.
What
is Session object? Describe in detail.
HTTP is a stateless protocol; it
can't hold the user information on web page. If user inserts some information,
and move to the next page, that data will be lost and user would not able to
retrieve the information. For accessing that information we have to store
information. Session provides that facility to store information on server
memory. It can support any type of object to store. For every user Session data
store separately means session is user specific.

Storing the data in Session object.
Session [“message”] = “Hello
World!”;
Retreving the data from Session
object.
Label1.Text =
Session[“message”].ToString();
What
are the Advantages and Disadvantages of Session?
Following are the basic advantages
and disadvantages of using session.
Advantages:
- It stores user states and data to
all over the application.
- Easy mechanism to implement and we
can store any kind of object.
- Stores every user data separately.
- Session is secure and transparent
from user because session object is stored on the server.
Disadvantages:
- Performance overhead in case of
large number of user, because of session data stored in server memory.
- Overhead involved in serializing
and De-Serializing session Data. Because In case of StateServer and SQLServer
session mode we need to serialize the object before store.
Describe
the Master Page.
Master pages in ASP.NET works as a
template that you can reference this page in all other content pages. Master
pages enable you to define the look and feel of all the pages in your site in a
single location. If you have done changes in master page, then the changes will
reflect in all the web pages that reference master pages. When users request
the content pages, they merge with the master page to produce output that combines
the layout of the master page with the content from the content page.

ContentPlaceHolder control is
available only on master page. You can use more than one ContentPlaceHolder
control in master page. To create regions that content pages can fill in, you
need to define ContentPlaceHolder controls in master page as follows:
<asp:ContentPlaceHolder
ID=”ContentPlaceHolder1” runat=”server”>
</asp:ContentPlaceHolder>
The page-specific content is then
put inside a Content control that points to the relevant
ContentPlaceHolder:
<asp:Content ID=”Content1”
ContentPlaceHolderID=”ContentPlaceHolder1” Runat=”Server”>
</asp:Content>
Note that the ContentPlaceHolderID attribute of the Content control points to the ContentPlaceHolder that is defined in the master page.
</asp:Content>
Note that the ContentPlaceHolderID attribute of the Content control points to the ContentPlaceHolder that is defined in the master page.
The master page is identified by a
special @ Master directive that replaces the @ Page directive that is used for
ordinary .aspx pages.
<%@ Master
Language="C#" AutoEventWireup="true"
CodeFile="CareerRide.master.cs" Inherits="CareerRide" %>
How
you can access the Properties and Controls of Master Pages from content pages?
You can access the Properties and
Controls of Master Pages from content pages. In many situations you need User’s
Name in different content pages. You can set this value inside the master page
and then make it available to content pages as a property of the master page.
We will follow the following steps
to reference the properties of master page from content pages.
Step: 1
Create a property in the master page
code-behind file.
public String UserName
{
get {
return (String)Session["Name"];
}
set {
Session ["Name"] = value;
}
}
{
get {
return (String)Session["Name"];
}
set {
Session ["Name"] = value;
}
}
Step: 2
Add the @ MasterTypedeclaration to
the .aspx content page to reference master properties in a content page. This
declaration is added just below the @ Page declaration as follows:
<%@ Page Title=" TEST"
Language="C#" MasterPageFile="~/CareerRide.master"
AutoEventWireup="true" CodeFile="CareerRideWelcome.aspx.cs"
Inherits="CareerRideWelcome" %>
<%@
MasterTypeVirtualPath="~/CareerRide.master" %>
Step: 3
Once you add the @ MasterType
declaration, you can reference properties in the master page using the Master
class. For example take a label control that id is ID="Label1"
Label1.Text= Master.UserName ;
For referencing controls in the
Master Page we will write the following code.
Content Page Code.
protected void Button1_Click(object
sender, EventArgs e)
{
TextBox txtName= (TextBox)Master.FindControl("TextBox1");
Label1.Text=txtName.Text;
}
{
TextBox txtName= (TextBox)Master.FindControl("TextBox1");
Label1.Text=txtName.Text;
}
To reference controls in a master
page, call Master.FindControl from the content page.
What
are the different method of navigation in ASP.NET?
Page navigation means moving from
one page to another page in your web site and another. There are many ways to
navigate from one page to another in ASP.NET.
- Client-side navigation
- Cross-page posting
- Client-side browser redirect
- Client-Side Navigation
- Cross-page posting
- Client-side browser redirect
- Client-Side Navigation
Client-side navigation:
Client-side navigation allows the
user to navigate from one page to another by using client side code or HTML. It
requests a new Web page in response to a client-side event, such as clicking a
hyperlink or executing JavaScript as part of a button click.
Example:
Drag a HyperLink control on the form
and set the NavigateUrl property to the desired destination page.
HyperLinkControl: Source
<asp:HyperLink
ID="HyperLink1" runat="server"
NavigateUrl="~/Welcome.aspx"> Take a test from CareerRide
</asp:HyperLink>
Suppose that, this control is placed
on a Web page called CareerRide.aspx, and the HyperLink control is clicked, the
browser simply requests the Welcome.aspx page.
Second method of client-side
navigation is through JavaScript.
Example:
Take an HTML button control on web
page. Following is the HTML code for the input button.
<input id="Button1"
type="button" value="Go to next page" onclick="return
Button1_onclick()" />
When the Button1 is clicked, the
client-side method, Button1_onclick will be called. The JavaScript source for
the Button1_onclick method is as follows:
<script
language="javascript" type="text/javascript">
function Button1_onclick()
{
document.location="NavigateTest2.aspx";
}
function Button1_onclick()
{
document.location="NavigateTest2.aspx";
}
</script>
Cross-page posting:
Example:
Suppose that we have two pages, the
first page is FirstPage.aspx and Second page is SecondPage.aspx. The First Page
has a Button and TextBox control and its ID is Button1 and TextBox1
respectively. A Button control has its PostBackUrl property. Set this property
to “~/SecondPage.aspx”. When the user clicks on Button, the data will send to
SecondPage for processing. The code for SecondPage is as follows:
protected void Page_Load(object
sender, EventArgs e)
{
if(Page.PreviousPage == null)
{
Label1.Text = "No previous page in post";
}
else
{
Label1.Text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;
}
}
{
if(Page.PreviousPage == null)
{
Label1.Text = "No previous page in post";
}
else
{
Label1.Text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;
}
}
The second page contains a Label
control and its ID is Label1.
The page that receives the PostBack
receives the posted data from the firstpage for processing. We can consider
this page as the processing page.The processing page often needs to access data
that was contained inside the initial page that collected the data and
delivered the PostBack. The previous page’s data is available inside the Page.PreviousPage
property. This property is only set if a cross-page post occurs.
Client-side browser redirect:
The Page.Response object
contains the Redirect method that can be used in your server-side code
to instruct the browser to initiate a request for another Web page. The
redirect is not a PostBack. It is similar to the user clicking a hyperlink on a
Web page.
Example:
protected void Button1_Click(object
sender, EventArgs e)
{
Response.Redirect ("Welcome.aspx");
}
{
Response.Redirect ("Welcome.aspx");
}
In client-side browser redirect
method an extra round trip to the server is happened.
Server-side transfer:
In this technique Server.Transfer
method is used. The Transfer method transfers the entire context of a
Web page over to another page. The page that receives the transfer generates
the response back to the user’s browser. In this mechanism the user’s Internet
address in his browser does not show the result of the transfer. The user’s
address bar still reflects the name of the originally requested page.
protected void Button1_Click(object
sender, EventArgs e)
{
Server.Transfer("MyPage.aspx", false);
}
{
Server.Transfer("MyPage.aspx", false);
}
The Transfer method has an overload
that accepts a Boolean parameter called preserve-Form. You set this parameter
to indicate if you want to keep the form and query string data.
ASP.NET interview questions
- April 16, 2013 at 01:36 PM by Kshipra Singh
1.
What does the Orientation property do in a Menu control?
Orientation property of the Menu
control sets the display of menu on a Web page to vertical or horizontal.
Originally the orientation is set to vertical.
Originally the orientation is set to vertical.
2.
Differentiate between:
a.)Client-side
and server-side validations in Web pages.
- Client-side validations happends
at the client's side with the help of JavaScript and VBScript. This happens
before the Web page is sent to the server.
- Server-side validations occurs place at the server side.
- Server-side validations occurs place at the server side.
b.)Authentication
and authorization.
- Authentication is the process of
verifyng the identity of a user using some credentials like username and
password while authorization determines the parts of the system to which a
particular identity has access.
- Authentication is required before authorization.
For e.g. If an employee authenticates himself with his credentials on a system, authorization will determine if he has the control over just publishing the content or also editing it.
- Authentication is required before authorization.
For e.g. If an employee authenticates himself with his credentials on a system, authorization will determine if he has the control over just publishing the content or also editing it.
3.a.)
What does the .WebPart file do?
It explains the settings of a Web
Parts control that can be included to a specified zone on a Web page.
b.)
How would you enable impersonation in the web.config file?
In order to enable the impersonation
in the web.confing file, take the following steps:
- Include the <identity> element in the web.config file.
- Set the impersonate attribute to true as shown below:
<identity impersonate = "true" />
- Include the <identity> element in the web.config file.
- Set the impersonate attribute to true as shown below:
<identity impersonate = "true" />
4.
a.) Differentiate between
a.)File-based
dependency and key-based dependency.
- In file-based dependency, the
dependency is on a file saved in a disk while in key-based dependency, you
depend on another cached item.
b.)
Globalization and localization.
- Globalization is a technique to
identify the part of a Web application that is different for different
languages and separate it out from the web application while in localization
you try to configure a Web application so that it can be supported for a
specific language or locale.
5.
a.)Differentiate between a page theme and a global theme?
- Page theme applies to a particular
web pages of the project. It is stored inside a subfolder of the App_Themes
folder.
- Global theme applies to all the web applications on the web server. It is stored inside the Themes folder on a Web server.
- Global theme applies to all the web applications on the web server. It is stored inside the Themes folder on a Web server.
b.)What
are Web server controls in ASP.NET?
- These are the objects on ASP.NET
pages that run when the Web page is requested.
- Some of these Web server controls, like button and text box, are similar to the HTML controls.
- Some controls exhibit complex behavior like the controls used to connect to data sources and display data.
- Some of these Web server controls, like button and text box, are similar to the HTML controls.
- Some controls exhibit complex behavior like the controls used to connect to data sources and display data.
6.
a.) Differentiate between a HyperLink control and a LinkButton control.
- A HyperLink control does not have
the Click and Command events while the LinkButton control has them, which can
be handled in the code-behind file of the Web page.
b.)
How do Cookies work? Give an example of their abuse.
- The server directs the browser to
put some files in a cookie. All the cookies are then sent for the domain in
each request.
- An example of cookie abuse could be a case where a large cookie is stored affecting the network traffic.
- An example of cookie abuse could be a case where a large cookie is stored affecting the network traffic.
7.
a.) What are Custom User Controls in ASP.NET?
- These are the controls defined by
developers and work similart to other web server controls.
- They are a mixture of custom behavior and predefined behavior.
- They are a mixture of custom behavior and predefined behavior.
b.)
What is Role-based security?
- Used in almost all organization,
the Role-based security assign certain privileges to each role.
- Each user is assigned a particular role from the list.
- Privileges as per role restrict the user's actions on the system and ensure that a user is able to do only what he is permitted to do on the system.
- Each user is assigned a particular role from the list.
- Privileges as per role restrict the user's actions on the system and ensure that a user is able to do only what he is permitted to do on the system.
8.
What are the HTML server controls in ASP.NET?
- HTML server controls are similar
to the standard HTML elements like those used in HTML pages.
- They expose properties and events for programatical use.
- To make these controls programmatically accessible, we specify that the HTML controls act as a server control by adding the runat="server" attribute.
- They expose properties and events for programatical use.
- To make these controls programmatically accessible, we specify that the HTML controls act as a server control by adding the runat="server" attribute.
9.
a.) What are the various types of Cookies in ASP.NET?
There exist two types of cookies in
ASP.NET
- Session Cookie - It resides on the machine of the client for a single session and works until the user logs out of the session.
- Persistent Cookie - It resides on the machine of a user for a specified period. This period can be set up manually by the user.
- Session Cookie - It resides on the machine of the client for a single session and works until the user logs out of the session.
- Persistent Cookie - It resides on the machine of a user for a specified period. This period can be set up manually by the user.
b.)
How would you turn off cookies on one page of your website?
- This can be done by using the
Cookie.Discard property.
- It Gets or sets the discard flag set by the server.
- When set to true, this property instructs the client application not to save the Cookie on the hard disk of the user at the end of the session.
- It Gets or sets the discard flag set by the server.
- When set to true, this property instructs the client application not to save the Cookie on the hard disk of the user at the end of the session.
c.)
How would you create a permanent cookie?
- Permanent cookies are stored on
the hard disk and are available until a specified expiration date is reached.
- To create a cookie that never expires set its Expires property equal to DateTime.maxValue.
- To create a cookie that never expires set its Expires property equal to DateTime.maxValue.
10.
a.) Explain Culture and UICulture values.
- Culture value determines the
functions like Date and Currency used to format data and numbers in a Web page.
- UICulture value determines the resources like strings or images loaded in a Web application for a Web page.
- UICulture value determines the resources like strings or images loaded in a Web application for a Web page.
b.)
What is Global.asax file used for?
It executes application-level events
and sets application-level variables.
11.
a.) Explain ASP.NET Web Forms.
- Web Forms are an extremely
important part of ASP.NET.
- They are the User Interface (UI) elements which provide the desired look and feel to your web applications.
- Web Forms provide properties, methods, and events for the controls that are placed onto them.
- They are the User Interface (UI) elements which provide the desired look and feel to your web applications.
- Web Forms provide properties, methods, and events for the controls that are placed onto them.
b.)
What is event bubbling?
- When child control send events to
parent it is termed as event bubbling.
- Server controls like Data grid, Data List, and Repeater can have other child controls inside them.
- Server controls like Data grid, Data List, and Repeater can have other child controls inside them.
12.
What are the various types of validation controls provided by ASP.NET?
ASP.NET provides 6 types of
validation controls as listed below:
i.) RequiredFieldValidator - It is used when you do not want the container to be empty. It checks if the control has any value or not.
ii.) RangeValidator - It checks if the value in validated control is within the specified range or not.
iii.) CompareValidator - Checks if the value in controls matches some specific values or not.
iv.) RegularExpressionValidator - Checks if the value matches a specific regular expression or not.
v.) CustomValidator - Used to define User Defined validation.
vi.) Validation Summary -Displays summary of all current validation errors on an ASP.NET page.
i.) RequiredFieldValidator - It is used when you do not want the container to be empty. It checks if the control has any value or not.
ii.) RangeValidator - It checks if the value in validated control is within the specified range or not.
iii.) CompareValidator - Checks if the value in controls matches some specific values or not.
iv.) RegularExpressionValidator - Checks if the value matches a specific regular expression or not.
v.) CustomValidator - Used to define User Defined validation.
vi.) Validation Summary -Displays summary of all current validation errors on an ASP.NET page.
13.
Differentiate between:
a.)
Namespace and Assembly.
- Namespace is a naming convenience
for logical design-time while an assembly establishes the name scope for types
at run time.
b.)
Early binding and late binding.
Early binding means calling a
non-virtual method that is decided at a compile time while Late binding refers
to calling a virtual method that is decided at a runtime.
14.
What are the different kinds of assemblies?
There can be two types of
assemblies.
i.) Static assemblies -
- They are stored on disk in portable executable files.
- It includes .NET Framework types like interfaces and classes, resources for the assembly (bitmaps, JPEG files, resource files etc.).
ii.) Dynamic assemblies -
- They are not saved on disk before execution rather they run directly from memory.
- They can be saved to disk after they have been executed.
i.) Static assemblies -
- They are stored on disk in portable executable files.
- It includes .NET Framework types like interfaces and classes, resources for the assembly (bitmaps, JPEG files, resource files etc.).
ii.) Dynamic assemblies -
- They are not saved on disk before execution rather they run directly from memory.
- They can be saved to disk after they have been executed.
15.
Differentiate between Structure and Class.
- Structures are value type while
Classes are reference type.
- Structures can not have constructor or destructors while Classes can have them.
- Structures do not support Inheritance while Classes do support Inheritance.
- Structures can not have constructor or destructors while Classes can have them.
- Structures do not support Inheritance while Classes do support Inheritance.
16.
Explain ViewState.
- It is a .Net mechanism to store
the posted data among post backs.
- It allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.
- It allows the state of objects to be stored in a hidden field on the page, saved on client side and transported back to server whenever required.
17.
What are the various types of Authentication?
There are 3 types of Authentication
namely Windows, Forms and Passport Authentication.
- Windows authentication - It uses the security features integrated in Windows NT and Windows XP OS to authenticate and authorize Web application users.
- Forms authentication - It allows you to create your own list of users and validate their identity when they visit the Web site.
- Passport authentication - It uses the Microsoft centralized authentication provider to identify users. Passport allows users to use a single identity across multiple Web applications. Passport SDK needs to be installed to use Passport authentication in your Web application.
- Windows authentication - It uses the security features integrated in Windows NT and Windows XP OS to authenticate and authorize Web application users.
- Forms authentication - It allows you to create your own list of users and validate their identity when they visit the Web site.
- Passport authentication - It uses the Microsoft centralized authentication provider to identify users. Passport allows users to use a single identity across multiple Web applications. Passport SDK needs to be installed to use Passport authentication in your Web application.
18.
Explain Server-side scripting and Client-side scripting.
- Server side scripting - All the
script are executed by the server and interpreted as needed.
- Client side scripting means that the script will be executed immediately in the browser such as form field validation, email validation, etc. It is usaullay carrried out in VBScript or JavaScript.
- Client side scripting means that the script will be executed immediately in the browser such as form field validation, email validation, etc. It is usaullay carrried out in VBScript or JavaScript.
19.
a.) What is garbage collection?
It is a system where a run-time component
takes responsibility for managing the lifetime of objects and the heap memory
that they occupy.
b.)
Explain serialization and deserialization.
- Serialization is the process of
converting an object into a stream of bytes.
- Deserialization is the process of creating an object from a stream of bytes.
Both these processes are usually used to transport objects.
- Deserialization is the process of creating an object from a stream of bytes.
Both these processes are usually used to transport objects.
20.
What are the various session state management options provided by ASP.NET?
- ASP.NET provides two session state
management options - In-Process and Out-of-Process state management.
- In-Process stores the session in memory on the web server.
- Out-of-Process stores data in an external data source. This data source may be a SQL Server or a State Server service. Out-of-Process state management needs all objects stored in session to be
- In-Process stores the session in memory on the web server.
- Out-of-Process stores data in an external data source. This data source may be a SQL Server or a State Server service. Out-of-Process state management needs all objects stored in session to be
Describe
how Passport authentication works.
ASP.NET application with Passport
authentication implemented checks the user’s machine for a current passport
authentication cookie. If it is not available, ASP.NET directs the user to a
Passport sign-on page. The Passport service authenticates the user, stores an
authentication cookie on the user’s computer and direct the user to the
requested page.
Explain
the steps to be followed to use Passport authentication.
1. Install the Passport SDK.
2. Set the application’s authentication mode to Passport in Web.config.
3. Set authorization to deny unauthenticated users.
3. Use the PassportAuthentication_OnAuthenticate event to access the user’s Passport profile to identify and authorize the user.
4. Implement a sign-out procedure to remove Passport cookies from the user’s machine.
2. Set the application’s authentication mode to Passport in Web.config.
3. Set authorization to deny unauthenticated users.
3. Use the PassportAuthentication_OnAuthenticate event to access the user’s Passport profile to identify and authorize the user.
4. Implement a sign-out procedure to remove Passport cookies from the user’s machine.
Explain
the advantages of Passport authentication.
User doesn’t have to remember
separate user names and passwords for various Web sites
User can maintain his or her profile information in a single location.
Passport authentication also avail access to various Microsoft services, such as Passport Express Purchase.
User can maintain his or her profile information in a single location.
Passport authentication also avail access to various Microsoft services, such as Passport Express Purchase.
What
is caching?
Caching is the technique of storing
frequently used items in memory so that they can be accessed more quickly.
By caching the response, the request is served from the response already stored in memory.
It’s important to choose the items to cache wisely as Caching incurs overhead.
A Web form that is frequently used and does not contain data that frequently changes is good for caching.
A cached web form freezes form’s server-side content and changes to that content do not appear until the cache is refreshed.
By caching the response, the request is served from the response already stored in memory.
It’s important to choose the items to cache wisely as Caching incurs overhead.
A Web form that is frequently used and does not contain data that frequently changes is good for caching.
A cached web form freezes form’s server-side content and changes to that content do not appear until the cache is refreshed.
Explain
the use of duration attribute of @OutputCache page directive.
The @OutputCache directive’s
Duration attribute determines how long the page is cached.
If the duration attribute is set to 60 seconds, the Web form is cached for 60 seconds; the server loads the response in memory and retains that response for 60 seconds.
Any requests during that time receive the cached response.
Once the cache duration has expired, the next request generates a new response and cached for another 60 seconds.
If the duration attribute is set to 60 seconds, the Web form is cached for 60 seconds; the server loads the response in memory and retains that response for 60 seconds.
Any requests during that time receive the cached response.
Once the cache duration has expired, the next request generates a new response and cached for another 60 seconds.
1.
Explain how a web application works.
Answer:
A web application resides in the server and serves the client's requests over internet. The client access the web page using browser from his machine. When a client makes a request, it receives the result in the form of HTML which are interpreted and displayed by the browser.
A web application on the server side runs under the management of Microsoft Internet Information Services (IIS). IIS passes the request received from client to the application. The application returns the requested result in the form of HTML to IIS, which in turn, sends the result to the client.
A web application resides in the server and serves the client's requests over internet. The client access the web page using browser from his machine. When a client makes a request, it receives the result in the form of HTML which are interpreted and displayed by the browser.
A web application on the server side runs under the management of Microsoft Internet Information Services (IIS). IIS passes the request received from client to the application. The application returns the requested result in the form of HTML to IIS, which in turn, sends the result to the client.
2.
Explain the advantages of ASP.NET.
Answer:
Following are the advantages of
ASP.NET.
Web application exists in compiled form on the server so the execution speed is faster as compared to the interpreted scripts.
ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model.
Being part of .Framework, it has access to all the features of .Net Framework.
Content and program logic are separated which reduces the inconveniences of program maintenance.
ASP.NET makes for easy deployment. There is no need to register components because the configuration information is built-in.
To develop program logic, a developer can choose to write their code in more than 25 .Net languages including VB.Net, C#, JScript.Net etc.
Introduction of view state helps in maintaining state of the controls automatically between the postbacks events.
ASP.NET offers built-in security features through windows authentication or other authentication methods.
Integrated with ADO.NET.
Built-in caching features.
Web application exists in compiled form on the server so the execution speed is faster as compared to the interpreted scripts.
ASP.NET makes development simpler and easier to maintain with an event-driven, server-side programming model.
Being part of .Framework, it has access to all the features of .Net Framework.
Content and program logic are separated which reduces the inconveniences of program maintenance.
ASP.NET makes for easy deployment. There is no need to register components because the configuration information is built-in.
To develop program logic, a developer can choose to write their code in more than 25 .Net languages including VB.Net, C#, JScript.Net etc.
Introduction of view state helps in maintaining state of the controls automatically between the postbacks events.
ASP.NET offers built-in security features through windows authentication or other authentication methods.
Integrated with ADO.NET.
Built-in caching features.
3.
Explain the different parts that constitute ASP.NET application.
Answer:
Content, program logic and
configuration file constitute an ASP.NET application.
Content files
Content files include static text, images and can include elements from database.
Program logic
Program logic files exist as DLL file on the server that responds to the user actions.
Configuration file
Configuration file offers various settings that determine how the application runs on the server.
Content files
Content files include static text, images and can include elements from database.
Program logic
Program logic files exist as DLL file on the server that responds to the user actions.
Configuration file
Configuration file offers various settings that determine how the application runs on the server.
4.
Describe the sequence of action takes place on the server when ASP.NET
application starts first time
Answer:
Following are the sequences:
IIS starts ASP.NET worker process - worker process loads assembly in the memory - IIS sends the request to the assembly - the assembly composes a response using program logic - IIS returns the response to the user in the form of HTML.
IIS starts ASP.NET worker process - worker process loads assembly in the memory - IIS sends the request to the assembly - the assembly composes a response using program logic - IIS returns the response to the user in the form of HTML.
5.
Explain the components of web form in ASP.NET
Answer:
Server controls
The server controls are Hypertext Markup Language (HTML) elements that include a runat=server attribute. They provide automatic state management and server-side events and respond to the user events by executing event handler on the server.
HTML controls
These controls also respond to the user events but the events processing happen on the client machine.
Data controls
Data controls allow to connect to the database, execute command and retrieve data from database.
System components
System components provide access to system-level events that occur on the server.
The server controls are Hypertext Markup Language (HTML) elements that include a runat=server attribute. They provide automatic state management and server-side events and respond to the user events by executing event handler on the server.
HTML controls
These controls also respond to the user events but the events processing happen on the client machine.
Data controls
Data controls allow to connect to the database, execute command and retrieve data from database.
System components
System components provide access to system-level events that occur on the server.
6.
Describe in brief .NET Framework and its components.
Answer:
.NET Framework provides platform for
developing windows and web software. ASP.NET is a part of .Net framework and
can access all features implemented within it that was formerly available only
through windows API. .NET Framework sits in between our application programs
and operating system.
The .Net Framework has two main components:
.Net Framework Class Library: It provides common types such as data types and object types that can be shared by all .Net compliant language.
The Common language Runtime: It provides services like type safety, security, code execution, thread management, interoperability services.
The .Net Framework has two main components:
.Net Framework Class Library: It provides common types such as data types and object types that can be shared by all .Net compliant language.
The Common language Runtime: It provides services like type safety, security, code execution, thread management, interoperability services.
7.
What is an Assembly? Explain its parts
Answer:
An assembly exists as a .DLL or .EXE
that contains MSIL code that is executed by CLR. An assembly contains interface
and classes, it can also contain other resources like bitmaps, files etc. It
carries version details which are used by the CLR during execution. Two
assemblies of the same name but with different versions can run side-by-side
enabling applications that depend on a specific version to use assembly of that
version. An assembly is the unit on which permissions are granted. It can be
private or global. A private assembly is used only by the application to which
it belongs, but the global assembly can be used by any application in the
system.
The four parts of an assembly are:
Assembly Manifest - It contains name, version, culture, and information about referenced assemblies.
Type metadata - It contains information about types defined in the assembly.
MSIL - MSIL code.
Resources - Files such as BMP or JPG file or any other files required by application.
The four parts of an assembly are:
Assembly Manifest - It contains name, version, culture, and information about referenced assemblies.
Type metadata - It contains information about types defined in the assembly.
MSIL - MSIL code.
Resources - Files such as BMP or JPG file or any other files required by application.
8.
Define Common Type System.
Answer:
.Net allows developers to write
program logic in at least 25 languages. The classes written in one language can
be used by other languages in .Net. This service of .Net is possible through
CTS which ensure the rules related to data types that all language must follow.
It provides set of types that are used by all .NET languages and ensures .NET
language type compatibility.
9.
Define Virtual folder.
Answer:
It is the folder that contains web
applications. The folder that has been published as virtual folder by IIS can
only contain web applications.
10.
Describe the Events in the Life Cycle of a Web Application
Answer:
A web application starts when a
browser requests a page of the application first time. The request is received
by the IIS which then starts ASP.NET worker process (aspnet_wp.exe). The worker
process then allocates a process space to the assembly and loads it. An
application_start event occurs followed by Session_start. The request is then
processed by the ASP.NET engine and sends back response in the form of HTML.
The user receives the response in the form of page.
The page can be submitted to the server for further processing. The page submitting triggers postback event that causes the browser to send the page data, also called as view state to the server. When server receives view state, it creates new instance of the web form. The data is then restored from the view state to the control of the web form in Page_Init event.
The data in the control is then available in the Page_load event of the web form. The cached event is then handled and finally the event that caused the postback is processed. The web form is then destroyed. When the user stops using the application, Session_end event occurs and session ends. The default session time is 20 minutes. The application ends when no user accessing the application and this triggers Application_End event. Finally all the resources of the application are reclaimed by the Garbage collector.
The page can be submitted to the server for further processing. The page submitting triggers postback event that causes the browser to send the page data, also called as view state to the server. When server receives view state, it creates new instance of the web form. The data is then restored from the view state to the control of the web form in Page_Init event.
The data in the control is then available in the Page_load event of the web form. The cached event is then handled and finally the event that caused the postback is processed. The web form is then destroyed. When the user stops using the application, Session_end event occurs and session ends. The default session time is 20 minutes. The application ends when no user accessing the application and this triggers Application_End event. Finally all the resources of the application are reclaimed by the Garbage collector.
11.
What are the ways of preserving data on a Web Form in ASP.NET?
Answer:
ASP.NET has introduced view state to preserve data between postback events. View state can't avail data to other web form in an application. To provide data to other forms, you need to save data in a state variable in the application or session objects.
ASP.NET has introduced view state to preserve data between postback events. View state can't avail data to other web form in an application. To provide data to other forms, you need to save data in a state variable in the application or session objects.
12.
Define application state variable and session state variable.
Answer:
These objects provide two levels of
scope:
Application State
Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application’s configuration settings. By default, SessionID values are stored in a cookie.
Application State
Data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application’s configuration settings. By default, SessionID values are stored in a cookie.
13.
Describe the application event handlers in ASP.NET
Answer:
Following are the application event
handlers:
Application_Start: This event occurs when the first user visits a page of the application.
Application_End: This event occurs when there are no more users of the application.
Application_BeginRequest: This occurs at the beginning of each request to the server.
Application_EndRequest: occurs at the end of each request to the server.
Session_Start: This event occurs every time when any new user visits.
Session_End: occurs when the users stop requesting pages and their session times out.
Application_Start: This event occurs when the first user visits a page of the application.
Application_End: This event occurs when there are no more users of the application.
Application_BeginRequest: This occurs at the beginning of each request to the server.
Application_EndRequest: occurs at the end of each request to the server.
Session_Start: This event occurs every time when any new user visits.
Session_End: occurs when the users stop requesting pages and their session times out.
14.
What are the Web Form Events available in ASP.NET?
Answer:
Page_Init
Page_Load
Page_PreRender
Page_Unload
Page_Disposed
Page_Error
Page_AbortTransaction
Page_CommitTransaction
Page_DataBinding
Page_Load
Page_PreRender
Page_Unload
Page_Disposed
Page_Error
Page_AbortTransaction
Page_CommitTransaction
Page_DataBinding
15.
Describe the Server Control Events of ASP.NET.
Answer:
ASP.NET offers many server controls like button, textbox, DropDownList etc. Each control can respond to the user's actions using events and event handler mechanism.
There are three types of server control events:
Postback events
This events sends the web page to the server for processing. Web page sends data back to the same page on the server.
Cached events
These events are processed when a postback event occurs.
Validation events
These events occur just before a page is posted back to the server.
ASP.NET offers many server controls like button, textbox, DropDownList etc. Each control can respond to the user's actions using events and event handler mechanism.
There are three types of server control events:
Postback events
This events sends the web page to the server for processing. Web page sends data back to the same page on the server.
Cached events
These events are processed when a postback event occurs.
Validation events
These events occur just before a page is posted back to the server.
16.
How do you change the session time-out value?
Answer:
The session time-out value is
specified in the web.config file within sessionstate element. You can change
the session time-out setting by changing value of timeout attribute of
sessionstate element in web.config file.
17.
Describe how ASP.NET maintains process isolation for each Web application
Answer:
In ASP.NET, when IIS receives a
request, IIS uses aspnet_isapi.dll to call the ASP.NET worker process (aspnet_wp.exe).
The ASP.NET worker process loads the Web application's assembly, allocating one
process space, called the application domain, for each application. This is the
how ASP.NET maintains process isolation for each Web application.
18.
Define namespace.
Answer:
Namespaces are the way to organize
programming code. It removes the chances of name conflict. It is quite possible
to have one name for an item accidentally in large projects those results into
conflict. By organizing your code into namespaces, you reduce the chance of
these conflicts. You can create namespaces by enclosing a class in a
Namespace...End Namespace block.
You can use namespaces outside your project by referring them using References dialog box. You can use Imports or using statement to the code file to access members of the namespaces in code.
You can use namespaces outside your project by referring them using References dialog box. You can use Imports or using statement to the code file to access members of the namespaces in code.
19.
What are the options in ASP.NET to maintain state?
Answer:
Client-side state management
This maintains information on the client’s machine using Cookies, View State, and Query Strings.
Cookies
A cookie is a small text file on the client machine either in the client’s file system or memory of client browser session. Cookies are not good for sensitive data. Moreover, Cookies can be disabled on the browser. Thus, you can’t rely on cookies for state management.
View State
Each page and each control on the page has View State property. This property allows automatic retention of page and controls state between each trip to server. This means control value is maintained between page postbacks. Viewstate is implemented using _VIEWSTATE, a hidden form field which gets created automatically on each page. You can’t transmit data to other page using view state.
Querystring
Query strings can maintain limited state information. Data can be passed from one page to another with the URL but you can send limited size of data with the URL. Most browsers allow a limit of 255 characters on URL length.
Server-side state management
This kind of mechanism retains state in the server.
Application State
The data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application’s configuration settings. By default, SessionID values are stored in a cookie.
Database
Database can be used to store large state information. Database support is used in combination with cookies or session state.
This maintains information on the client’s machine using Cookies, View State, and Query Strings.
Cookies
A cookie is a small text file on the client machine either in the client’s file system or memory of client browser session. Cookies are not good for sensitive data. Moreover, Cookies can be disabled on the browser. Thus, you can’t rely on cookies for state management.
View State
Each page and each control on the page has View State property. This property allows automatic retention of page and controls state between each trip to server. This means control value is maintained between page postbacks. Viewstate is implemented using _VIEWSTATE, a hidden form field which gets created automatically on each page. You can’t transmit data to other page using view state.
Querystring
Query strings can maintain limited state information. Data can be passed from one page to another with the URL but you can send limited size of data with the URL. Most browsers allow a limit of 255 characters on URL length.
Server-side state management
This kind of mechanism retains state in the server.
Application State
The data stored in the application object can be shared by all the sessions of the application. Application object stores data in the key value pair.
Session State
Session State stores session-specific information and the information is visible within the session only. ASP.NET creates unique sessionId for each session of the application. SessionIDs are maintained either by an HTTP cookie or a modified URL, as set in the application’s configuration settings. By default, SessionID values are stored in a cookie.
Database
Database can be used to store large state information. Database support is used in combination with cookies or session state.
20.
Explain the difference between Server control and HTML control.
Answer:
Server events
Server control events are handled in the server whereas HTML control events are handled in the page.
State management
Server controls can maintain data across requests using view state whereas HTML controls have no such mechanism to store data between requests.
Browser detection
Server controls can detect browser automatically and adapt display of control accordingly whereas HTML controls can’t detect browser automatically.
Properties
Server controls contain properties whereas HTML controls have attributes only.
Server control events are handled in the server whereas HTML control events are handled in the page.
State management
Server controls can maintain data across requests using view state whereas HTML controls have no such mechanism to store data between requests.
Browser detection
Server controls can detect browser automatically and adapt display of control accordingly whereas HTML controls can’t detect browser automatically.
Properties
Server controls contain properties whereas HTML controls have attributes only.
21.
What are the validation controls available in ASP.NET?
Answer:
ASP.NET validation controls are:
RequiredFieldValidator: This validates controls if controls contain data.
CompareValidator: This allows checking if data of one control match with other control.
RangeValidator: This verifies if entered data is between two values.
RegularExpressionValidator: This checks if entered data matches a specific format.
CustomValidator: Validate the data entered using a client-side script or a server-side code.
ValidationSummary: This allows developer to display errors in one place.
RequiredFieldValidator: This validates controls if controls contain data.
CompareValidator: This allows checking if data of one control match with other control.
RangeValidator: This verifies if entered data is between two values.
RegularExpressionValidator: This checks if entered data matches a specific format.
CustomValidator: Validate the data entered using a client-side script or a server-side code.
ValidationSummary: This allows developer to display errors in one place.
22.
Define the steps to set up validation control.
Answer:
Following are the steps to set up
validation control
Drag a validation control on a web form.
Set the ControlToValidate property to the control to be validated.
If you are using CompareValidator, you have to specify the ControlToCompare property.
Specify the error message you want to display using ErrorMessage property.
You can use ValidationSummary control to show errors at one place.
Drag a validation control on a web form.
Set the ControlToValidate property to the control to be validated.
If you are using CompareValidator, you have to specify the ControlToCompare property.
Specify the error message you want to display using ErrorMessage property.
You can use ValidationSummary control to show errors at one place.
23.
What are the navigation ways between pages available in ASP.NET?
Answer:
Ways to navigate between pages are:
Hyperlink control
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open script method
Hyperlink control
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open script method
24.
How do you open a page in a new window?
Answer:
To open a page in a new window, you
have to use client script using onclick="window.open()" attribute of
HTML control.
25.
Define authentication and authorization.
Answer:
Authorization: The process of
granting access privileges to resources or tasks within an application.
Authentication: The process of validating the identity of a user.
Authentication: The process of validating the identity of a user.
26.
Define caching.
Answer:
Caching is the technique of storing
frequently used items in memory so that they can be accessed more quickly.
Caching technique allows to store/cache page output or application data on the
client on the server. The cached information is used to serve subsequent
requests that avoid the overhead of recreating the same information. This
enhances performance when same information is requested many times by the user.
27.
Define cookie.
Answer:
A cookie is a small file on the
client computer that a web application uses to maintain current session
information. Cookies are used to identity a user in a future session.
28.
What is delegate?
Answer:
A delegate acts like a strongly type
function pointer. Delegates can invoke the methods that they reference without
making explicit calls to those methods. It is type safe since it holds
reference of only those methods that match its signature. Unlike other classes,
the delegate class has a signature. Delegates are used to implement event
programming model in .NET application. Delegates enable the methods that listen
for an event, to be abstract.
29.
Explain Exception handling in .Net.
Answer:
Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR has provided structured way to deal with exceptions using Try/Catch block. ASP.NET supports some facilities to handling exceptions using events such as
Exceptions or errors are unusual occurrences that happen within the logic of an application. The CLR has provided structured way to deal with exceptions using Try/Catch block. ASP.NET supports some facilities to handling exceptions using events such as
30.
What is impersonation?
Answer:
Impersonation means delegating one
user identity to another user. In ASP.NET, the anonymous users impersonate the
ASPNET user account by default. You can use <identity> element of
web.config file to impersonate user. E.g. <identity impersonate="true"/>
31.
What is managed code in .Net?
Answer:
The code that runs under the
guidance of common language runtime (CLR) is called managed code. The
versioning and registration problem which are formally handled by the windows
programming are solved in .Net with the introduction of managed code. The
managed code contains all the versioning and type information that the CLR use
to run the application.
32.
What are Merge modules?
Answer:
Merge modules are the deployment
projects for the shared components. If the components are already installed,
the modules merge the changes rather than unnecessarily overwrite them. When
the components are no longer in use, they are removed safely from the server
using Merge modules facility.
33.
What is Satellite assembly?
Answer:
Satellite assembly is a kind of
assembly that includes localized resources for an application. Each satellite
assembly contains the resources for one culture.
34.
Define secured sockets layer.
Answer:
Secured Socket Layer (SSL) ensures a
secured web application by encrypting the data sent over internet. When an
application is using SSL facility, the server generates an encryption key for
the session and page is encrypted before it sent. The client browse uses this
encryption key to decrypt the requested Web page.
35.
Define session in ASP.NET.
Answer:
A session starts when the browser
first request a resources from within the application. The session gets
terminated when either browser closed down or session time out has been
attained. The default time out for the session is 20 minutes.
36.
Define Tracing.
Answer:
Tracing is the way to maintain
events in an application. It is useful while the application is in debugging or
in the testing phase. The trace class in the code is used to diagnose problem.
You can use trace messages to your project to monitor events in the released
version of the application. The trace class is found in the System.Diagnostics
namespace. ASP.NET introduces tracing that enables you to write debug
statements in your code, which still remain in the code even after when it is
deployed to production servers.
37.
Define View State.
Answer:
ASP.NET preserves data between
postback events using view state. You can save a lot of coding using view state
in the web form. ViewState serialize the state of objects and store in a hidden
field on the page. It retains the state of server-side objects between
postbacks. It represents the status of the page when submitted to the server.
By default, view state is maintained for each page. If you do not want to
maintain the ViewState, include the directive <%@ Page
EnableViewState="false" %> at the top of an .aspx page or add the
attribute EnableViewState="false" to any control. ViewState exist for
the life of the current page.
38.
What is application domain?
Answer:
It is the process space within which
ASP.NET application runs. Every application has its own process space which
isolates it from other application. If one of the application domains throws
error it does not affect the other application domains.
39.
List down the sequence of methods called during the page load.
Answer:
Init() - Initializes the page.
Load() - Loads the page in the server memory.
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - runs just after page finishes loading.
Load() - Loads the page in the server memory.
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - runs just after page finishes loading.
40.
What is the importance of Global.asax in ASP.NET?
Answer:
The Global.asax is used to implement
application and session level events.
41.
Define MSIL.
Answer:
MSIL is the Microsoft Intermediate
Language. All .Net languages' executable exists as MSIL which gets converted
into machine specific language using JIT compiler just before execution.
42.
Response.Redirect vs Server.Transfer
Answer:
Server.Transfer is only applicable
for aspx files. It transfers page processing to another page without making
round-trip back to the client's browser. Since no round trips, it offers faster
response and doesn't update client url history list.
Response.Redirect is used to redirect to another page or site. This performs a trip back to the client where the client’s browser is redirected to the new page.
Response.Redirect is used to redirect to another page or site. This performs a trip back to the client where the client’s browser is redirected to the new page.
43.
Explain Session state management options in ASP.NET.
Answer:
ASP.NET provides In-Process and
Out-of-Process state management. In-Process stores the session in memory on the
web server. Out-of-Process Session state management stores data in an external
data source such as SQL Server or a State Server service. Out-of-Process state
management requires that all objects stored in session are serializable.
44.
How to turn off cookies for a page?
Answer:
Cookie.Discard Property when true,
instructs the client application not to save the Cookie on the user's hard disk
when a session ends.
45.
How can you ensure a permanent cookie?
Answer:
Setting Expires property to MinValue
and restrict cookie to get expired.
46.
What is AutoPostback?
Answer:
AutoPostBack automatically posts the
page back to the server when state of the control is changed.
47.
Explain login control and form authentication.
Answer:
Login controls encapsulate all the
features offered by Forms authentication. Login controls internally use
FormsAuthentication class to implement security by prompting for user
credentials validating them.
48.
What is the use of Web.config file?
Answer:
Following are the setting you can
incorporate in web.config file.
Database connections
Error Page setting
Session States
Error Handling
Security
Trace setting
Culture specific setting
Database connections
Error Page setting
Session States
Error Handling
Security
Trace setting
Culture specific setting
49.
Explain in what order a destructors is called.
Answer:
Destructors are called in reverse
order of constructors. Destructor of most derived class is called followed by
its parent's destructor and so on till the topmost class in the hierarchy.
50.
What is break mode? What are the options to step through code?
Answer:
Break mode lets you to observe code
line to line in order to locate error. VS.NET provides following option to step
through code.
Step Into
Step Over
Step Out
Run To Cursor
Set Next Statement
Step Into
Step Over
Step Out
Run To Cursor
Set Next Statement
51.
Explain how to retrieve property settings from XML .config file.
Answer:
Create an instance of
AppSettingsReader class, use GetValue method by passing the name of the
property and the type expected. Assign the result to the appropriate variable.
52.
Explain Global Assembly Cache.
Answer:
Global Assembly Cache is the place
holder for shared assembly. If an assembly is installed to the Global Assembly
Cache, the assembly can be accessed by multiple applications. In order to
install an assembly to the GAC, the assembly must have to be signed with strong
name.
53.
Explain Managed code an Un-managed code.
Answer:
Managed code runs under the safe
supervision of common language runtime. Managed code carries metadata that is
used by common language runtime to offer service like memory management, code
access security, and cross-language accessibility.
Unmanaged code doesn't follow CLR conventions and thus, can't take the advantages of .Framework.
Unmanaged code doesn't follow CLR conventions and thus, can't take the advantages of .Framework.
54.
What is side-by-side execution?
Answer:
This means multiple version of same
assembly to run on the same computer. This feature enables to deploy multiple
versions of the component.
55.
Define Resource Files.
Answer:
Resource files contains
non-executable data like strings, images etc that are used by an application
and deployed along with it. You can changes these data without recompiling the
whole application.
56.
Define Globalization and Localization.
Answer:
Globalization is the process of
creating multilingual application by defining culture specific features like
currency, date and time format, calendar and other issues. Localization is the
process of accommodating cultural differences in an application.
57.
What is reflection?
Answer:
Reflection is a mechanism through
which types defined in the metadata of each module can be accessed. The
System.Reflection namespaces contains classes that can be used to define the
types for an assembly.
58.
Define Satellite Assemblies.
Answer:
Satellite Assemblies are the special
kinds of assemblies that exist as DLL and contain culturespecific resources in
a binary format. They store compiled localized application resources. They can
be created using the AL utility and can be deployed even after deployment of
the application. Satellite Assemblies encapsulate resources into binary format
and thus makes resources lighter and consume lesser space on the disk.
59.
What is CAS?
Answer:
CAS is very important part of .Net
security system which verifies if particular piece of code is allowed to run.
It also determines if piece of code have access rights to run particular
resource. .NET security system applies these features using code groups and
permissions. Each assembly of an application is the part of code group with
associated permissions.
60.
Explain Automatic Memory Management in .NET.
Answer:
Automatic memory management in .Net
is through garbage collector which is incredibly efficient in releasing
resources when no longer in use.
Latest answer: Forms authentication can be easily implemented using login
controls without writing any code. Login control performs functions like
prompting for user credentials, validating them and issuing authentication just
as the FormsAuthentication class...............
Latest answer: Fragment caching refers to the caching of individual user
controls within a Web Form. Each user control can have independent cache
durations and implementations of how the caching behavior is to be
applied.............
Latest answer: Partial classes allow us to divide the class definition into
multiple files (physically). Logically, all the partial classes are treated as
a single file by the compiler............
Latest answer: FromHTMLinasppage:<ahref="abc.aspx?qstring1=test">Test
Query String</a>
From server side code: <%response.redirect "webform1.aspx?id=11"%>...............
From server side code: <%response.redirect "webform1.aspx?id=11"%>...............
Chapter-2
ASP.NET is a web application development framework for
building web sites and web applications that follows object oriented
programming approach". Following are the top 10 commonly asked Interview Questions with Answers on ASP.NET:
What is the concept of Postback in ASP.NET?
A postback is a request sent from a client to server from the same page user is already working with.
ASP.NET was introduced with a mechanism to post an HTTP POST request back to the same page. It's basically posting a complete page back to server (i.e. sending all of its data) on same page. So, the whole page is refreshed.
Another concept related to this approach is "Callback" that is also asked sometimes during a technical interview question. Click here to understand Difference between ASP.NET WebForms and ASP.NET MVC?
ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it's own controller i.e. code-behind file that processes the request. On the other hand, ASP.NET MVC uses Front Controller approach. In this approach a common controller for all pages, processes the requests.
Please briefly explain ASP.NET Page life Cycle?
ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.
Initialization: Controls raise their Init event in this stage.Objects and variables are initializes for complete lifecyle of request.
LoadViewState: is a post back stage and loads the view state for the controls that enabled its view state property.
LoadPostBackData: is also a post back stage and loads the data posted for the controls and update them.
Load: In this stage page as well as all the controls raise their Load event. Till this stage all the controls are initialized and loaded. In most of the cases, we are coding this event handler.
RaisePostBackEvent: is again a postback stage. For example, it's raise against a button click event. We can easily put our code here to perform certain actions.
SaveViewState: Finally, controls state is saved in this stage before Rendering HTML.
Render: This is the stage where HTML is generated for the page.
Dispose: Lastly, all objects associated with the request are cleaned up.
For very detailed explanation of Page Life Cycle is explained
What is the difference between custom controls and user controls?
Custom controls are basically compiled code i.e. DLLs. These can be easily added to toolbox, so it can be easily used across multiple projects using drag and drop approach. These controls are comparatively hard to create.
But User Controls (.ascx) are just like pages (.aspx). These are comparatively easy to create but tightly couple with respect to User Interface and code. In order to use across multiple projects, we need to copy and paste to the other project as well.
What is the concept of view state in ASP.NET?
As in earlier question, we understood the concept of postback. So, in order to maintain the state between postbacks, ASP.NET provides a mechanism called view state. Hidden form fields are used to store the state of objects on client side and returned back to server in subsequent request (as postback occurs).Difference between Response.Redirect and Server.Transfer?
In case of Response.Redirect, a new request is generated from client-side for redirected page. It's a kind of additional round trip. As new request is generated from client, so the new URL is visible to user in browser after redirection.While in case of Server.Transfer, a request is transferred from one page to another without making a round trip from client. For the end user, URL remains the same in browser even after transferring to another page.
Please briefly explain the usage of Global.asax?
Global.asax is basically ASP.NET Application file. It’s a place to write code for Application-level events such as Application start, Application end, Session start and end, Application error etc. raised by ASP.NET or by HTTP Modules.There is a good list of events that are fired but following are few of the important events in Global.asax:
Application_Init
occurs in case of application initialization for the very first time.Application_Start
fires on application start.Session_Start
fires when a new user session startsApplication_Error
occurs in case of an unhandled exception generated from application.Session_End
fires when user session ends.Application_End
fires when application ends or time out.
What are the different types of Validation controls in ASP.NET?
In order to validate user input, ASP.NET provides validation server controls. All validation controls inherits from BaseValidator class which contains the common validation properties and methods likeControlToValidate
, Enabled
, IsValid
, EnableClientScript
,
ValidationGroup
,Validate()
etc. ASP.NET provides a range of validation controls:
RequiredFieldValidator
validates compulsory/required input.RangeValidator
validates the range. Validates that input falls between the given range values.CompareValidator
validates or compares the input of a control with another control value or with a fixed value.RegularExpressionValidator
validates input value against a defined regular expression pattern.CustomValidator
allows to customize the validation logic with respect to our application logic.ValidationSummary
displays all errors on page collectively.
What are the types of Authentication in ASP.NET?
There are three types of authentication available in ASP.NET:- Windows Authentication: This authentication method uses built-in windows security features to authenticate user.
- Forms Authentication: authenticate against a customized list of users or users in a database.
- Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.
What are Session state modes in ASP.NET?
ASP.NET supports different session state storage options:- In-Process is the default approach. It stores session state locally on same web server memory where the application is running.
- StateServer mode stores session state in a process other than the one where application is running. Naturally, it has added advantages that session state is accessible from multiple web servers in a Web Farm and also session state will remain preserved even web application is restarted.
- SQLServer mode stores session state in SQL Server database. It has the same advantages as that of StateServer.
- Custom modes allows to define our custom storage provider.
- Off mode disables session storage.
Part-2
Latest answer: Viewstate is used to maintain or
retain values on postback. It helps in preserving a page. Viewstate is
internally maintained as a hidden field in encrypted form along with a
key............
Read answer
Latest answer: Src: is a way mention the name of the
code-behind class to dynamically compile on the request for a page.
...............
Read answer
Latest answer: URI - Uniform Resource Identifier: it’s a string and its
responsibility is to identify a resource by meta-information. It gives
information about only one resource............
Read answer
Latest answer: It is a process where things that can
be handled before compilation are prepared in order to reduce the deployment
time, response time, increase safety. It’s main aim to boost
performance.............
Read answer
Latest answer: Custom controls are user defined
controls. They can be created by grouping existing controls, by deriving the
control from System.Web.UI.WebControls..........
Read answer
Latest answer: An operating system process can have
many ongoing application domains. Application Domains keep an application
separate. All objects created within the same application scope are created
within the same application domain...........
Read answer
Latest answer: SAO Server Activated Object (call
mode): lasts the lifetime of the server. They are activated as
SingleCall/Singleton objects. It makes objects stateless...........
Read answer
Latest answer: Remoting has at least three
sections:-
1.
Server
2. Client: This connects to the hosted remoting object 3. Common Interface between client and the server .i.e. the channel.......... Read answer
Latest answer: Singleton architecture is to be used
when all the applications have to use or share same data...........
Read answer
Latest answer: The LeaseTime property protects the
object so that the garbage collector does not destroy it as remoting objects
are beyond the scope of the garbage collector. Every object created has a
default leasetime for which it will be activated..........
Read answer
Latest answer: The remoting parameters can be
specified through both programming and in config files. All the settings
defined in config files are placed under <system.runtime.remoting>...........
Read answer
Latest answer: Marshaling is a process of
transforming or serializing data from one application domain and exporting it
to another application domain...........
Read answer
Latest answer: ObjRef is a searializable object
returned by Marshal() that knows about location of the remote object, host
name, port number, and object name........
Read answer
Latest answer: Every service listed has a URI
pointing to the service's DISCO or WSDL document, which is needed to access
the webservice and its 'webmethod" methods..........
Read answer
Latest answer: Create a new website by selecting
"ASP.NET Web Site" and giving it a suitable name. service.cs
file appears inside the solution with a default webmethod named as
"HelloWorld()"........
Read answer
Latest answer: Application Object: Application
variable/object stores an Object with a scope of availability of the entire
Application unless explicitly destroyed.............
Read answer
Latest answer: The cache object has dependencies
e.g. relationships to the file it stores. Cache items remove the object when
these dependencies change. As a work around we would need to simply execute a
callback method............
Read answer
Latest answer: A process where items are removed
from cache in order to free the memory based on their priority. A property
called "CacheItemPriority" is used to figure out the priority of
each item inside the cache...........
Read answer
Latest answer: Page output: Is used to fetch
information or data at page level. It is best used when the site is mainly
static. Used by declaring the output page directive............
Read answer
Latest answer: The ways to cache different versions
on the same page using ASP.NET cache object is using OutputCache
object............
Read answer
Latest answer: Fragment cache is to store user
controls individually within a web form in cache instead of the whole webform
as such. The idea is to simply have different cache parameters for different
user controls.............
Read answer
Latest answer: Types of sessions: InProc: The
default way to use sessions. InProc is the fastest way to store and access
sessions...........
Read answer
Latest answer: Advantages: Easy to
implement, Hidden fields are supported by all browsers, Enables
faster access of information because data is stored on client
side............
Read answer
Latest answer: Advantages: Hidden frames allow you to cache more than one data
field, The ability to cache and access data items stored in different
hidden forms...........
Read answer
Latest answer: Advantages: They are simple to use. Light in size, thus occupy
less memory. Stores server information on client side. Data need
not to be sent back to server........
Read answer
Latest answer: Querystring is way to transfer
information from one page to another through the URL........
Read answer
Latest answer: Absolute and sliding expiration are
two Time based expiration strategies. Absolute Expiration: Cache in this case
expires at a fixed specified date or time..............
Read answer
Latest answer: Cross-page posting is done at the
control level. It is possible to create a page that posts to different pages
depending on what button the user clicks on. It is handled by done by
changing the postbackurl property of the controls..........
Read answer
Latest answer: PreviousPage property is set to the
page property of the nest page to access the viewstate value of the page in
the next page. Page poster = this.PreviousPage;..........
Read answer
Latest answer: SQL Cache Dependency in ASP.NET: It
is the mechanism where the cache object gets invalidated when the related
data or the related resource is modified.........
Read answer
Latest answer: Post Cache Substitution: It works
opposite to fragment caching. The entire page is cached, except what is to be
kept dynamic. When [OutputCache] attribute is used, the page is
cached............
Read answer
Latest answer: Users of different countries, use
different languages and others settings like currency, and dates. Therefore,
applications are needed to be configurable as per the required settings based
on cultures, regions, countries........
Read answer
Latest answer: Code Page was used before Unicode
came into existence. It was a technique to represent characters in different
languages..........
Read answer
Latest answer: Resource files are files in XML
format. They contain all the resources needed by an application. These files
can be used to store string, bitmaps, icons, fonts........
Read answer
Latest answer: To support the feature of multiple
languages, we need to create different modules that are customized on the
basis of localization. These assemblies created on the basis of different
modules are knows as satellite assemblies...........
Read answer
Latest answer: Al.exe: It embeds the resources into
a satellite assembly. It takes the resources in .resources binary
format.......
Read answer
Latest answer: ResourceManager class: It provides
convenient access to resources that are culture-correct. The access is provided
at run time.........
Read answer
Latest answer: WCF is a framework that builds
applications that can inter-communicate based on service oriented
architecture consuming secure and reliable web services.............
Read answer
Latest answer: A service-oriented architecture is
collection of services which communicate with one another other......
Read answer
Latest answer: WCF Service is composed of three
components: Service class: It implements the service needed, Host
environment: is an environment that hosts the developed service.............
Read answer
Latest answer: WCF can create services similar in
concept to ASMX, but has much more capabilities. WCF is much more efficient
than ASP.Net coz it is implemented on pipeline............
Read answer
Latest answer: Duplex contract: It enables clients
and servers to communicate with each other. The calls can be initiated
independently of the other one.............
Read answer
Latest answer: Read Uncommitted: - Also known as
Dirty isolation level. It makes sure that corrupt Data cannot be read. This
is the lowest isolation level............
Read answer
Latest answer: Volatile Queues: There are scenarios
in the project when you want the message to deliver in proper time. The
timely delivery of message is very more important and to ensure they are not
lost is important too. Volatile queues are used for such
purposes.............
Read answer
Latest answer: Windows Workflow Foundation (WF): It is a platform for building,
managing and executing workflow-enabled applications, for designing and
implementing a programming model ..........
Read answer
Latest answer: There are 3 types of workflows in WWF:
Sequential Workflow: The sequential workflow style executes a set of
contained activities in order, one by one and does not provide an option to
go back to any step...........
Read answer
Latest answer: XOML is an acronym for Extensible
Object Markup Language. XOML files are the markup files. They are used to
declare the workflow and are then compiled with the file containing the
implementation logic..............
Read answer
Latest answer: Microsoft's Internet Information
Services web server software is used to make an application offline. The IIS
is instructed to route all incoming requests for the web site to another URL
automatically........
Read answer
Latest answer: Script injection attacks called
Cross-site scripting (XSS) attacks exploit vulnerabilities in Web page
validation by injecting client-side script code.............
Read answer
Latest answer: Authentication is the process of
verifying user’s details and find if the user is a valid user to the system
or not. This process of authentication is needed to provide authority to the
user........
Read answer
Latest answer: Authorization is a process that takes
place based on the authentication of the user. Once authenticated, based on
user’s credentials, it is determined what rights des a user have...........
Read answer
Login
controls are part of ASP. Net’s UI controls collection which allows users to
enter their username and password to login to a website/application. They
provide login solution without the need of writing code...........
Read answer
Fragment
caching does not cache a WebForm, rather it allows for caching of individual
user controls within a Web Form, where each control can have different cache
duration and behavior...........
Read answer
.Net2.0
supports the concept of partial classes which is unlike the concept of one
class one file. In .Net technology, one can define a single class over
multiple files using the concept of partial classes............
Read answer
Yesyoucandoitusingahyperlink<BR><ahref="Abc.aspx?name=test">Click
to go to aspx </a>.............
Read answer
.NET
Compact Framework is a scaled down versions of .NET framework for supporting
Windows CE based mobile and embedded devices like mobile
phones...............
LINQ
is a set of extensions to .NET Framework that encapsulate language integrated
query, set and other transformation operations....................
Access
modifiers are used to control the scope of type members.
There arefive access modifiers that p rovide varying levels of access........... Read answer
System.Web.UI.Page..........
Read answer
Overriding
- Methods have the same signature as the parent class method............
Read answer
System.Web.UI.Page.Culture............
Read answer
In
C#.NET, we implement using ":"
In VB.Net we implements using "Inherits" keyword........... Read answer
Server-side
code executes on the server.
Client-side code executes in the client's browser.......... Read answer
A
Dataset can represent an entire relational database in memory, complete with
tables, relations, and views...............
Read answer
The
Global.asax is including the Global.asax.cs file.
You can implement application........ Read answer
Inline
code written along side the html in a page.
Code-behind is code written in a separate file and referenced by the .aspx page........ Read answer
MSIL
is the Microsoft Intermediate Language.
.NET compatible application will get converted to MSIL on compilation........... Read answer
The
Page class...........
Read answer
Low
(IIS Process): This is the fastest and the default IIS4 setting. ASP pages
run in INetInfo.exe and so they are executed in-process. If ASP crashes, IIS
too does and must be restarted...........
Read answer
Also read
With
ASP.NET 2.0, Microsoft has raised the bar to a much higher level by providing
excellent out-of-thebox features that are not only geared toward increasing
the productivity of developers but also toward simplifying the administration
and management of ASP.NET 2.0 applications...............
With
ASP.NET 2.0, the ASP.NET team has a goal of reducing the number of lines of
code required for an application by a whopping 70%. To this end, Microsoft
has introduced a collective arsenal of new features that are now available to
developers in ASP.NET 2.0..............
ASP.NET
2.0 introduces a new concept known as master pages, in which a common base
master file contains the common look and feel and standard behavior for all
the pages in your application. Once the common content is placed in the
master page, the content pages (child pages) can inherit content from the
master pages apart from adding their content to the final
output................
ASP.NET
2.0 introduces a third model: a new form of code-behind that relies on the
new partial classes support in the Visual C# and Visual Basic compilers.
Code-behind in ASP.NET 2.0 fixes a nagging problem with version 1.x: the
requirement that code-behind classes contain protected fields whose types and
names map to controls declared in the ASPX file...............
Prior
to ASP.NET 2.0, if you were to reference a reusable component from your
ASP.NET application, you had to compile the assembly and place it in the bin
folder (or place it in the GAC) of the web application............
ASP.NET
impersonation is controlled by entries in the applications web.config
file...........
How
do we access crystal reports in .NET?
What are the various components in crystal reports? What basic steps are needed to display a simple report in crystal?.......... |
PART-3
ASP.NET
interview questions - part 3
It
belongs to the type but not to any instance of a type.
It can be accessed without creating an instance of the type.............. Read answer
Option
Strict On enables type checking at design time and prevents.............
Read answer
Boxing
allows you to treat a value type the same as a reference type........
Read answer What does WSDL stand for?
It
allows the state of objects (serializable) to be stored in a hidden field on
the page.
It is transported to the client and back to the server, and is not stored on the server or any other external source............... Read answer
It
allows the page to save the users input on a form across postbacks.
It saves the server-side values for a given control into ViewState............. Read answer
Delegates
provide the functionality behind events.
A delegate is a strongly typed function pointer................ Read answer
Classes
are the blueprints for objects.
A class acts as a template for any number of distinct objects......... Read answer
ASP.NET
provides In-Process and Out-of-Process state management.
In-Process stores the session in memory on the web server............. Read answer
Init()
- when the page is instantiated.
Load() - when the page is loaded into server memory......... Read answer
It
is data-access technology, primarily disconnected and designed to provide
efficient, scalable data access. The disconnected data is
represented within a DataSet object.............
Read answer
Also read
One
of the important goals of ASP.NET 2.0 is 70% code reduction. The data
controls supplied with ASP.NET 2.0 play an important role in making this ambitious
goal a reality. Data source controls provide a consistent and extensible
method for declaratively accessing data from web pages..............
With
ASP.NET 2.0, things have changed for the better. For security-related
functionalities, ASP.NET 2.0 introduces a wide range of new
controls..............
In
addition to the new controls, ASP.NET 2.0 also provides numerous enhancements
to existing controls that make these controls more versatile than ever before
in building component-based web pages. For example, the Panel control now has
a DefaultButton property that specifies which button should be clicked if the
user presses the Enter key while the panel has the focus.........
With
ASP.NET 2.0, Microsoft introduces a new feature known as validation groups,
which enables you to create different groups of validation controls and
assign them to input controls, such as text boxes. You can assign a
validation group to a collection of input controls if you want to validate
the collection of input controls on the same criteria............
One
of the neat features of ASP.NET 2.0 is themes, which enable you to define the
appearance of a set of controls once and apply the appearance to your entire
web application............
This
article describes state management in ASP.NET. It explains client-side state
management and server-side state management.
This
includes description about validation control, its types and steps to use
them in ASP.NET.
This
is complete article on ADO.NET with code and interview questions
|
PART-4
Server-side
code runs on the server.Client-side code runs on the client's
browser................
Read answer
Web
application projects create a virtual folder for each project where all the
files of the projects are stored.........
Read answer
A
Web application starts with the first request for a resource. On request, Web
forms are instantiated and processed in the server...........
Read answer
Create
a command object. Set the object’s CommandText property to the name of
the stored procedure.
Set the CommandType property to stored Procedure............ Read answer
Exception
handling correct unusual occurrences and prevent application from getting
terminated.........
Read answer
Exceptions
can be handled by using Try(try) block and Error event procedures at the
global, application, or page levels by using the Server object’s GetLastError
and ClearError methods..........
Read answer
Also read
ASP.NET
2.0 ships with a Web Parts Framework that provides the infrastructure and the
building blocks required for creating modular web pages that can be easily
customized by the users. You can use Web Parts to create portal pages that
aggregate different types of content, such as static text, links, and content
that can change at runtime..................
Visual
Studio 2005 is the best development tool for building data-driven web
applications. As part of the Visual Studio 2005 suite of tools, Microsoft is
introducing a new tool called Visual Web Developer (VWD) that is designed to
work with the current and next generation of ASP.NET. VWD provides powerful
new features for the web developer.................
One
of the key goals of ASP.NET 2.0 is to ease the effort required to deploy,
manage, and operate ASP.NET web sites. To this end, ASP.NET 2.0 features a
new Configuration Management API that enables users to programmatically build
programs or scripts that create, read, and update configuration files such as
Web.config and machine.config.............
As
part of the performance improvements, ASP.NET 2.0 also enhances the caching
feature set by providing new functionalities...........
Caching
is defined as temporary storage of data for faster retrieval on subsequent
requests. In ASP .NET 2.0, the caching support is integrated with the
DataSource controls to cache data in a web page. ASP.NET 2.0 also now
includes automatic database server cache invalidation............
we
will learn about MVC design patterns, and how Microsoft has made our lives
easier by creating the ASP.NET MVC framework for easier adoption of MVC
patterns in our web applications...............
Here
it shows how a page controller pattern works in ASP.NET.
MVC,
which stands for Model View Controller, is a design pattern that helps us
achieve the decoupling of data access and business logic from the
presentation code , and also gives us the opportunity to unit test the GUI
effectively and neatly, without worrying about GUI changes at all..........
|
PART5
scribe use of error pages in ASP.NET.
Error pages are used when exceptions are outside the scope of the application and the application can’t respond directly to these exceptions................Read answer
Explain tracing in ASP.NET.
Tracing records unusual events while an application is running. It helps in observing problems during testing and after deployment.............Read answer
What is the use of ComVisible attribute?
ComVisible attribute is used to select which public .NET classes and members are visible to COM.........Read answer
Define Windows and Forms authentication.
Windows authentication is the default authentication method of the ASP.NET application. It uses security scheme of windows operating system of corporate network.............Read answer
What is Secure Sockets Layer (SSL) security?
SSL protects data exchanged between a client and an ASP.NET application by encrypting the data before it is sent across the internet.............Read answer
Why is the Machine.config file?
The Machine.config file controls issue like process recycling, number of request queue limits, and what interval to check if user is connected..........Read answer
Explain how to distribute shared components as part of an installation program
Shared components should be included as a merge module within the setup project. Merge modules can’t be installed by themselves..................Read answer
Define Unit testing, Integration testing, Regression testing.
Unit testing ensures that each piece of code works correctly. Integration testing ensures each module work together without errors............Read answer
Define HTML and XML.
HTML: It has predefined elements names '<h1>', '<b>' etc.............Read answer
<<Previous Next>> Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6
Also readUnderstanding AJAX
AJAX is an acronym for Asynchronous JavaScript and XML. If you think it doesn't say much, we agree. Simply put, AJAX can be read "empowered JavaScript", because it essentially offers a technique for client-side JavaScript to make background server calls and retrieve additional data as needed, updating certain portions of the page without causing full page reloads.............ASP.NET 2.0 Features
With ASP.NET 2.0, Microsoft has raised the bar to a much higher level by providing excellent out-of-thebox features that are not only geared toward increasing the productivity of developers but also toward simplifying the administration and management of ASP.NET 2.0 applications...............ASP.NET 2.0 Developer Productivity
With ASP.NET 2.0, the ASP.NET team has a goal of reducing the number of lines of code required for an application by a whopping 70%. To this end, Microsoft has introduced a collective arsenal of new features that are now available to developers in ASP.NET 2.0..............Master Pages
ASP.NET 2.0 introduces a new concept known as master pages, in which a common base master file contains the common look and feel and standard behavior for all the pages in your application. Once the common content is placed in the master page, the content pages (child pages) can inherit content from the master pages apart from adding their content to the final output................MVC Design
MVC, which stands for Model View Controller, is a design pattern that helps us achieve the decoupling of data access and business logic from the presentation code , and also gives us the opportunity to unit test the GUI effectively and neatly, without worrying about GUI changes at all..........REST: Representation State Transfer
REST means Representational State Transfer, an architectural pattern used to identify and fetch resources from networked systems such as the World Wide Web (WWW). The REST architecture was the foundation of World Wide Web. But the term itself came into being around the year 2000, and is quite a buzzword these days...........
PART-6
Explain the use of DataAdapter.
-DataAdapter
provides the bridge to connect command objects to a dataset object.
-It populates
the table in the dataset from the data store and also pushes the changes in the
dataset back into the data store.
Methods of
DataAdapter:
Fill -
Populates the dataset object with data from the data source
FillSchema - Extracts the schema for a table from the data source
Update - It is use to update the data source with the changes made to the content of the dataset
FillSchema - Extracts the schema for a table from the data source
Update - It is use to update the data source with the changes made to the content of the dataset
What is impersonation in ASP.NET?
Impersonation
is a technique to access application resources using the identity of some other
user.
By default,
Impersonation is off
<identity
impersonate="true" userName="domain name\username"
password="password"/>
PART-7
Explain the difference between dataset and datareader.
Dataset is a
disconnected architecture whereas datareader is connected architecture
Dataset is the
best choice when we need to access data from more than one table.
Dataset is
handy when we need to move back while reading records.
Compare to
datareader, using dataset has an adverse affect on speed
Explain the various authentication mechanisms in ASP.NET.
ASP.NET
supports 3 authentication mechanisms:
a. Windows
Authentication: This is used for an intranet based application. Used to
authenticate domain users within a network. By default windows authentication
is used.
b. Form
Authentication: It’s a custom security based on roles and user accounts created
specifically for an application.
c. Passport
Authentication: This is based on hotmail passport account.
PART-8
Can you explain the basic use of DataView?
DataView is
used for sorting and searching data within datatable.
It has got
following methods:
Find - returns
the index of the row
FindRow - Returns a collection of DataRow
AddNew - Add a new row to the DataView object
Delete - Deletes the specific row from DataView object
FindRow - Returns a collection of DataRow
AddNew - Add a new row to the DataView object
Delete - Deletes the specific row from DataView object
What is Authorization in ASP.NET?
Usually after
a user is authenticated by means of a login, the process of authorization is
followed where the decision is made whether a user should be granted access to
a specific resource.
There are 2
ways to authorize access to a given resource:
URL
authorization:
URL
authorization is performed by the UrlAuthorizationModule
It maps users and roles to URLs in ASP.NET applications.
It maps users and roles to URLs in ASP.NET applications.
File
authorization:
File
authorization is performed by the FileAuthorizationModule.
It checks the access control list of the .aspx or .asmx handler file to determine whether a user should have access to the file.
It checks the access control list of the .aspx or .asmx handler file to determine whether a user should have access to the file.
PART-9
What is connection pooling and how to enable and disable connection pooling?
Connection
pool is created when we open connection first time. When a new connection is
created with same connection string as the first one, it reuses the same and
existing connection object from the pool without creating a new one.
If the
connection string is different then a new connection pooling will be created,
thus won't use the existing connection object.
By default, we
have connection pooling enabled in .Net. To disable connection pooling, set
Pooling = false in the connection string.
Why is an object pool required?
To enhance
performance and reduce the load of creating new objects, instead re using
existing objects stored in memory pool. Object Pool is a container of objects
that are for use and have already been created. Whenever an object creation
request occurs, the pool manager serves the request by allocating an object
from the pool. This minimizes the memory consumption and system's resources by
recycling and re-using objects. When the task of an object is done, it is sent
to the pool rather than being destroyed. This reduces the work for garbage
collector and fewer memory allocations occur.
PART-10
Can you explain the importance of Finalize method in .NET?
Clean up
activities are entrusted to .NET Garbage collector in .NET. But unmanaged
resources such as File, COM object etc. are beyond the scope of Garbage
collector. For these type of objects, we have Finalize method where clean up
code for unmanaged resources can be put.
Advantages and disadvantages of using cookies
Advantages:
Cookies are
stored in client thus no burden as far as space is concern
Cookies are
light weight and involves no complexities while using
Disadvantages:
Most browsers
have put a check on the size of a cookie.
Cookies can be
disabled on the client thus limiting the use of cookies
Cookies are
tampered prone and thus associate security concern
Cookies can
expire thus leading to inconsistency
PART-11
Latest answer: AppSetting section is used to set the user defined values.
For e.g.: The ConnectionString which is used through out the project for
database connection.........
Latest answer: Following are the major differences between them:
Server.Transfer - The browser is directly redirected to another
page. There is no round trip...........
Latest answer: Authentication is the process of verifying the identity of
a user. Authorization is process of checking whether the user has access
rights to the system..............
Latest answer: By default, ASP.NET executes in the security context of a
restricted user account on the local machine. However, at times it becomes
necessary to access network resources which require additional permissions.............
Latest answer: The passing of the control from the child to the parent is
called as bubbling. Controls like DataGrid, Datalist, Repeater, etc can have
child controls..........
Latest answer: ASP.NET runs inside the process of IIS due to which there
are two authentication layers which exist in the system.............
Latest answer: Selection of an authentication provider is done through
the entries in the web.config file for an application.The modes of
authentication are:.........
Latest answer: If windows authentication mode is selected for an ASP.NET
application, then authentication also needs to be configured within IIS since
it is provided by IIS............
Latest answer: Passport authentication provides authentication using
Microsoft’s passport service.
If passport authentication is configured and users login using passport then the authentication duties are off-loaded to the passport servers.............
Latest answer: Using form authentication, ones own custom logic can be
used for authentication. ASP.NET checks for the presence of a special session
cookie when a user requests a page for the application. ............
Latest answer: ASP.NET impersonation is controlled by entries in the
applications web.config file. Though the default setting is no impersonation,
it can be explicitly set using: ...........
Latest answer: Datagrid: The
HTML code generated has an HTML TABLE element created for the particular
DataRow and is a tabular representation with Columns and Rows. Datagrid has a
in-built support for Sort, Filter and paging the Data...........
Latest answer: Global.asax file contains the following events:
Application_Init - Fired when an application initializes or is first
called. It is invoked for all HttpApplication object instances.............
Latest answer: IIS has three level of isolation:- LOW (IIS process): In
this main IIS process and ASP.NET application run in same process due to
which if one crashes, the other is also affected............
Latest answer: GridLayout provides absolute positioning for controls
placed on the page. FlowLayout positions items down the page like traditional
HTML.........
Latest answer: Authentication is the process of verifying user’s details
and find if the user is a valid user to the system or not.......
Latest answer: Authorization is a process that takes place based on the
authentication of the user.......
|
Latest answer: The .NET framework has introduced a concept called Garbage
collector. This mechanism keeps track of the allocated memory references and
releases the memory when it is not in reference..........
Latest answer: Finalizer in .NET are the methods that help in cleanup the
code that is executed just before the object is garbage
collected..............
Latest answer: There are two types of cookies in ASP.NET -Single valued
cookies................
Latest answer: Following are the ways to retain variables between
requests:Context.Handler -This object can be used to retrieve public
members of the web form from a subsequent web page...........
Latest answer: Cookies are text files that store information about the
user. A user is differentiated from the other by the web server with the help
of the cookies. It can also determine where the user had been before with
them.............
Latest answer: The CLS contains constructs and constraints which provides
a guideline for library and compiler writers.Any language that supports CLS
can then use the libraries due to whic the languages can integrate with each
other................
|
No comments:
Post a Comment