You are on page 1of 35

ASP.

Net Interview Question and Answers


What is ASP?
Active Server Pages(ASP), also known as Classic ASP, is a Microsofts server side technology, which helps
in creating dynamic and user friendly Web pages.
It uses different scripting languages to create dynamic Web pages, which can be run on any type of
browser.

What is the difference between Classic ASP and ASP.Net?


Classic ASP:
ASP is Interpreted language based on scripting languages like Jscript or VBScript.
ASP has Mixed HTML and coding logic.
Limited development and debugging tools available.
Limited OOPS support.
Limited session and application state management.
ASP.NET:
ASP.Net is supported by compiler and has compiled language support.
Separate code and design logic possible.
Variety of compilers and tools available including the Visual studio.Net.
Completely Object Oriented.
Complete session and application state management.
Full XML Support for easy data exchange.

D. Harsha Vardhan

ASP.NET Interview Questions

What is ASP.NET?
ASP.NET is a server side scripting technology that enables scripts (embedded in web pages) to be
executed by an Internet server.
ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites and
Web services.
It is a part of .NET Framework.
The ASP.NET compiles the Web Pages and provides much better performance than scripting languages,
such as VBScript.
The Web Forms support to create powerful forms based Web pages.
ASP.NET Web server controls to create interactive Web applications with the help of Web server
controls, you can easily create a Web application.

What is a Cookie?
Cookie is a lightweight executable program, which the server posts to client machines.
Cookies store the identity of a user at the first visit of the Web site and validate them later of the next
visits for their authenticity.
The values of a cookie can be transferred between the users request and the servers response.

What is the difference between ASP Session State and ASP.Net Session State?
ASP session state relies on cookies, Serialize all requests from a client, does not survive process
shutdown, Can not maintained across machines in a Web farm.

What are the major built in objects in Asp.net?


The major built in objects in Asp.net are as follows:
Application
Request
Response
Server
D. Harsha Vardhan

ASP.NET Interview Questions

Session
Context
Trace

What is the difference between Server.Transfer and Response.Redirect?


The Server.Transfer () method stops the current page from executing, and runs the content on the
specified page, when the execution is complete the control is passed back to the calling page.
While the Response.Redirect () method transfers the control on the specified page and the control is
never passed back to calling page after execution.

What is a PostBack?
The process in which a Web page sends data back to the same page on the server.

What is AutoPostBack?
If you want a control to postback automatically when an event is raised, you need to set the
AutoPostBack property of the control to True.

What is a round trip?


The trip of a Web page from the client to the server and then back to the client is known as a round trip.

What are the types of Cookies in Asp.net?


There are two types of Cookies available in Asp.net:
Session Cookie
Persistent Cookie

D. Harsha Vardhan

ASP.NET Interview Questions

What is the difference between Session cookie and Persistent cookie?


Session Cookie:
Resides on the client machine for a single session until the user does not log out.
Persistent Cookie:
Resides on a users machine for a period specified for its expiry, such as 10 days, one month and never.
The user can set this period manually.

Which is the parent class of the Web server control?


The System.Web.UI.Control class is the parent class for all Web server controls.

Which Asp.net objects encapsulate the state of the client and the browser?
The Session object encapsulates the state of the client and browser.

What is the difference between Custom Control and User Control?


Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox.
Drag and Drop controls. Attributes can be set visually at design time. Can be used by Multiple
Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference
and use. Normally designed to provide common functionality independent of consuming Application.
User Controls are similar to those of ASP include files, easy to create, cannot be placed in the toolbox
and dragged - dropped from it. A User Control is shared among the single application files.

How can you identify that the page is PostBack?


The Page object uses the IsPostBack property to check whether the page is posted back or not. If the
page is postback, this property is set to true.

D. Harsha Vardhan

ASP.NET Interview Questions

What is ViewState?
ViewState is a .Net mechanism to store the posted data among post backs. ViewState 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.

What is Authentication and Authorization?


Authentication is the process of identifying users. Authentication is identifying/validating the user
against the credentials (username and password) and Authorization performs after authentication.
Authorization is the process of granting access to those users based on identity. Authorization allowing
access of specific resource to user.

What are the types of Authentication?


There are 3 types of Authentication. Windows, Forms and Passport Authentication.
Windows authentication uses the security features integrated into the Windows NT and Windows XP
operating systems to authenticate and authorize Web application users.
Forms authentication allows you to create your own list/database of users and validate the identity of
those users when they visit your Web site.
Passport authentication uses the Microsoft centralized authentication provider to identify users.
Passport provides a way to for users to use a single identity across multiple Web applications. To use
Passport authentication in your Web application, you must install the Passport SDK.

What are the different ways to send data across pages in Asp.net?
The following two ways are used to send data across pages in Asp.net:
Session
Public properties

D. Harsha Vardhan

ASP.NET Interview Questions

Where is the Viewstate information stored?


The Viewstate information is stored in the HTML hidden fields.

What are different types of directives in .NET?


@Page
@Control
@Import
@Implements
@Register
@Assembly
@OutputCache
@Reference

What is the default timeout for a cookie?


The default time duration for a cookie is 30 minutes.

What is the difference between HTML and Web server controls?


HTML controls are client side controls therefore, all the validations for HTML controls are performed at
the client side.
On the other hand, Web server controls are server side controls; therefore, all the validations for Web
server controls are performed at the server side.

What is the difference between Server-side scripting and Client-side scripting?


Server side scripting means that all the script will be executed by the server and interpreted as needed.
ASP doesn't have some of the functionality like sockets, uploading, etc.
Client side scripting means that the script will be executed immediately in the browser such as form field
validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript.
D. Harsha Vardhan

ASP.NET Interview Questions

How do you create a permanent cookie?


Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set
the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime.
If u want the cookie which never expires set its Expires property equal to DateTime.maxValue.

Which method do you use to redirect the user to another page without performing a round
trip to the client?
Server.Transfer
Server.Execute.

Which method do you use to redirect the user to another page without performing a round trip to the
client?
Server.transfer

What tag do you use to add a hyperlink column to the DataGrid?


< asp:HyperLinkColumn > < / asp:HyperLinkColumn >

How many languages .NET is supporting now?


When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. The site
DotNetLanguages.Net says 44 languages are supported.

What is smart navigation?


The cursor position is maintained when the page gets refreshed due to the server side validation and the
page gets refreshed.

How do you validate the controls in an ASP .NET page?


Using special validation controls that are meant for this. We have Range Validator, Email Validator

D. Harsha Vardhan

ASP.NET Interview Questions

How do you turn off cookies for one page in your site?
Use Cookie.Discard property, Gets or sets the discard flag set by the server. When true, this property
instructs the client application not to save the Cookie on the user's hard disk when a session ends.

Which two properties are on every validation control?


We have two common properties for every validation controls:
Control to Validate
Error Message

What are the event handlers that can be included in the Global.asax file?
The Global.asax file contains some of the following important event handlers:
Application_Error
Application_Start
Application_End
Session_Start
Session_End

What Asp.net objects encapsulate the state of the client and the browser?
The Session Object.

Which class is inherited when an Asp.net server control is added to a Web form?
The System.Web.UI.Webcontrols class is inherited when an Asp.net server controls is added to a web
form.

D. Harsha Vardhan

ASP.NET Interview Questions

What are the types of validation controls in Asp.net?


There are six types of validation controls in Asp.net:
Compare Validator
Custom Validator
Range Validator
Regular Expression Validator
RequiredField Validator
Validation Summary

How can you display all validation messages in one control?


The ValidationSummary control displays all validation messages in one control.

In which event are the controls fully loaded?


Page_load event guarantees that all controls are fully loaded. Controls are also accessed.
In Page_Init events but you will see that viewstate is not fully loaded during this event.

What is the use of @ Register directives?


@Register directive informs the compiler of any custom server control added to the page.

Define RequiredFieldValidator?
It checks whether the control have any value. It's used when you want the control should not be empty.

What are the different types of Session state management options available with ASP.NET?
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

D. Harsha Vardhan

ASP.NET Interview Questions

source. The external data source may be either a SQL Server or a State Server service. Out-of-Process
state management requires that all objects stored in session are serializable.

How can you display all validation messages in one control?


The ValidationSummary control displays all validation messages in one control.

What is the difference between a Label control and a Literal control?


The Label controls final html code has an HTML tag; whereas the Literal controls final html code
contains only text, which is not surrounded by any HTML tag.

What is the difference between ASP Session and ASP.NET Session?


Asp.net session supports cookie less session & it can span across multiple servers.

What is the function of Custom Validator?


It uses the customized validation code to perform client side validation and server side validation.

What data type does the RangeValidator control support?


Integer
String.
Date.
Double
Currency

What is Role based security?


A role is a named set of principals that have the same privileges with respect to security (such as a teller
or a manager). A principal can be a member of one or more roles. Therefore, applications can use role
membership to determine whether a principal is authorized to perform a requested action.
D. Harsha Vardhan

ASP.NET Interview Questions

Can we disable ViewState, If, yes how?


ViewState can be disabled by using "EnableViewState" property set to false.

Can you give an example of what might be best suited to place in the Application_Start and
Session_Start subroutines?
All the global declarations or the variables used commonly across the application can be deployed under
Application_Start. All the user specific tasks or declarations can be dealt in the Session_Start subroutine.

What are the types of ASP Objects?


There are various types of Asp objects are :
Session Object
Application Object
Server Object
Request Object
Request Object
Response Object
Object Context
Error Object

What base class do all Web Forms inherit from?


System.web.UI.Page class

How to Manage State in ASP.Net?


There are several ways to manage a state.
ViewState
QueryString

D. Harsha Vardhan

ASP.NET Interview Questions

Cookies
Session
Application

What is a Literal Control?


The Literal control is used to display text on a page. The text is programmable. This control does not let
you apply styles to its content.

Which namespaces are used for data access?


System.Data
System.Data.OleDb
System.Data.SqlClient

What is Remoting?
Remoting is a means by which one operating system process, or program, can communicate with
another process. The two processes can exist on the same computer or on two computers connected by
a LAN or the Internet.

Whats the use of GLOBAL.ASAX file?


It allows to executing ASP.NET application level events and setting application-level variables.

What is a SESSION and APPLICATION object?


Session object store information between HTTP requests for a particular user.
Session variables are used to store user specific information where as in application variables we cant
store user specific information.
while application object are global across users.

D. Harsha Vardhan

ASP.NET Interview Questions

What are all the types of data types available in ASP.NET?


There are two types of data types available in Asp.Net are :
Framework specific data type
Language specific data type

What is the difference between System.String and System.StringBuilder classes?


System.String is immutable.
System.StringBuilder was designed with the purpose of having a mutable string where a variety of
operations can be performed.

What is the differences between Server-side and Clientside code?


Server side code is executed at the server side on IIS in ASP.NET framework.
while client side code is executed on the browser.

What is the difference between Server-side scripting and Client-side scripting?


Server side scripting:
means that all the script will be executed by the server and interpreted as needed. ASP doesn't have
some of the functionality like sockets, uploading, etc.
Client side scripting:
means that the script will be executed immediately in the browser such as form field validation, clock,
email validation, etc. Client side scripting is usually done in VBScript or JavaScript.

What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end,
and deserializing and decoding messages into data on the other end.

D. Harsha Vardhan

ASP.NET Interview Questions

Which are the namespaces that are imported automatically by Visual Studio in ASP.Net?

There are 7 namespaces which are imported automatically :


System
System.Collections
System.IO
System.Web
System.Web.UI
System.Web.UI.HTMLControls
System.Web.UI.HTMLControls

What is an Asp.net Web form?


Asp.net Web forms are designed to use controls and features that are almost as powerful as the ones
used with Windows forms, and so they are called Web forms.
The Web forms uses a server side object model that allows you to create functional controls, which are
executed on the server and are rendered as HTML on the client.

What is a life span of a static variable?


A static variables life span is till the class is in memory

What is the use of Smart Navigation property?


It is a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.

How many namespaces are in .NET version 1.1?


124

D. Harsha Vardhan

ASP.NET Interview Questions

What is AutoPostback?
AutoPostBack automatically posts the page back to the server when state of the control is changed.

What is the difference between Web server controls and Custom user Controls in Asp.net?
The Asp.net Web server controls are objects on the Asp.net pages that run when the Web page is
requested. Many Web server controls such as button and text box, are similar to the HTML controls.
The Custom user controls are the controls that are defined by developers. These controls are a mixture
of custom behavior and predefined behavior.
These controls work similar to other Web server controls.

What is the main difference between Asp.net and Vb.net?


Asp.net is a web technology used for designing webforms and Vb.net is a programming language
ASP.NET is a powerful technology for writing dynamic web pages.
ASP.NET is a way of creating dynamic web pages while making use of the innovations present in .NET.
VB.NET is a language.But ASP.NET is the Environment where we can create websites or webpages.

Is string a value type or a reference type?


String is a Reference type. It can create a new instance at every time.

What base class do all Web Forms inherit from?


System.web.UI.Page class

What is the difference between an ADO.NET Dataset and an ADO Recordset?


A DataSet can represent an entire relational database in memory, complete with tables, relations, and
views.
A DataSet is designed to work without any continuing connection to the original data source.

D. Harsha Vardhan

ASP.NET Interview Questions

DataSets have no current record pointer You can use For Each loops to move through the data.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different data
sources.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
You can store many edits in a DataSet, and write them to the original data source in a single operation.

What are the validation controls?


A set of server controls included with ASP.NET that test user input in HTML and Web server controls for
programmer-defined requirements. Validation controls perform input checking in server code. If the
user is working with a browser that supports DHTML, the validation controls can also perform validation
using client script.

What is the difference between Web.config and Machine.Config?


Web.config files apply settings to each web application.
While Machine.config file apply settings to all ASP.NET applications.

What is event bubbling?


Server controls like Data grid, Data List, and Repeater can have other child controls inside them.
Example Data Grid can have combo box inside data grid. These child control do not raise there events by
themselves, rather they pass the event to the container parent (which can be a data grid, data list,
repeater), which passed to the page as ItemCommand event. As the child control send events to
parent it is termed as event bubbling.

What is the use of @ Register directives?


@Register directive informs the compiler of any custom server control added to the page.

D. Harsha Vardhan

ASP.NET Interview Questions

What are the various security methods which IIS Provides apart from .NET?
The various security methods which IIS provides are :
Authentication Modes.
IP Address and Domain Name Restriction.
DNS Lookups DNS Lookups.
Though the DataSet is universal, other objects in ADO.NET come in different versions for different
data sources.
The Network ID and Subnet Mask.
SSL.

What are Master Pages in ASP.NET?


ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single
master page defines the look and feel and standard behavior that you want for all of the pages in your
application. You can then create individual content pages that contain the content you want to display.
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.

What are the advantages of ASP.Net?


ASP.NET makes development simpler and easier to maintain with an event-driven, server-side
programming model.
ASP.NET offers built-in security features through windows authentication or other authentication
methods.
Content and program logic are separated which reduces the inconveniences of program maintenance.
Built-in caching features.

What is event bubbling?


Server controls like Data grid, Data List, and Repeater can have other child controls inside them.
Example Data Grid can have combo box inside data grid. These child control do not raise there events by
themselves, rather they pass the event to the container parent (which can be a data grid, data list,
D. Harsha Vardhan

ASP.NET Interview Questions

repeater), which passed to the page as ItemCommand event. As the child control send events to
parent it is termed as event bubbling.

What is WSDL?
WSDL stands for Web Services Description Language is an XML-based language for describing Web
services and how to access them.
WSDL is used to describe Web services.

How information about the users locale can be accessed?


The information regarding a users locale can be accessed by using the System.Web.UI.Page.Culture
property.

What is the difference between javascript and vbscript?


Javascript:
JavaScript is a client-side scripting language.
JavaScript is used to create interactive web applications supported by the Netscape browser.
JavaScript is simple to use, lightweight, and dynamic. Developers can easily embed code functionality for
interactive applications inside a web page.
Javascript is case sensitive and it will be run on client side.
VBScript:
VBScript is a server-side scripting language.
VBScript is not case sensitive and it will be run on server side.

What is a web server?


A web server delivers requested web pages to users who enter the URL in a web browser. Every
computer on the Internet that contains a web site must have a web server program.

D. Harsha Vardhan

ASP.NET Interview Questions

What file extension does ASP.NET use for Web Services?


ASP.NET uses the .asmx extension for Web Service files.

What is the base class of .net?


System.object

What are the standard event handler parameters for ASP.NET pages?
The standard parameter list is (Sender as Object, e as EventArgs).

What is State management?


State Management is used to store information requests. The state management is used to trace the
information or data that affect the state of the applications.

What are three programmatic improvements of ASP.NET over ASP?


Ease of deployment
Improved session state
The use of code declaration blocks

Write three common properties of all validation controls?


Three common properties of all validation controls are as
Control to Validate Provides a control to validate.
ErrorMessage Dispalys an error message.
IsValid Specifies if the controls validation has succeeded or not.
Text Displays a text for validation control before validation.

D. Harsha Vardhan

ASP.NET Interview Questions

Which property can be used to make a control post immediately to the server upon an event?
AutoPostBack

What base class do all Web Forms inherit from?


System.web.UI.Page class

How can you identify that the page is Postback?


The page object uses the IsPostBack property to check whether the page is posted back or not. If the
page is postback, this property is set to true.

How to Create a Cookie?


Cookie are one of several ways to store data about web site visitors during the time when web server
and browser are not connected. Common use of cookies is to remember users between visits.
Practically, cookie is a small text file sent by web server and saved by web browser on client machine.
TheResponse.Cookies command is used to create cookies.

How do you identify a Master Page?


The master page is identified by a special @ Master directive that replaces the @ Page directive that is
used for ordinary .aspx pages.

Explain what a diffgram is and a good use for one?


The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.
For reading database data to an XML file to be sent to a Web Service.

D. Harsha Vardhan

ASP.NET Interview Questions

What are the different types of Validation Controls?


There are six types of validation controls available:
RequiredFieldValidator
RangeValidator
RegularExpressionValidator
CompareValidator
CustomValidator
ValidationSummary

What is the Web User Control?


Combines existing Server and/or HTML controls by using VS.Net to create functional units that
encapsulate some aspects of UI. Resides in Content Files, which must be included in project in which the
controls are used.

What namespaces are necessary to create a localized application?


System.Globalization
System.Resources

What namespace do the ASP.NET Page and LiteralControl classes belong to?
System.Web.UI

What is the lifespan for items stored in ViewState?


Items stored in a ViewState exist for the life of the current page, including the post backs on the same
page.

D. Harsha Vardhan

ASP.NET Interview Questions

What is Side-by-Side Execution?


The CLR allows any versions of the same-shared DLL (shared assembly) to execute at the same time, on
the same system, and even in the same process. This concept is known as side-by-side execution.

How to view an assembly?


We can use the tool "ildasm.exe" known as "Assembly Disassembler" to view the assembly.

Which are the namespaces that are imported automatically by Visual Studio in ASP.Net?
There are 7 namespaces which are imported automatically.
System
System.Collections
System.IO
System.web
System.web.UI
System.web.UI.HTMLControls
System.web.UI.WebControls.

What are the layouts of ASP.NET Pages?


GridLayout
FlowLayout
GridLayout positions the form object on absolute x and y co-ordinates of the screen.
FlowLayout positions the form objects relative to each other.

What is a multilingual Website?


A multilingual Website serves content in a number of languages. It contains multiple copies for its
content and other resources, such as date and time, in different languages.

D. Harsha Vardhan

ASP.NET Interview Questions

What is a Namespace? What is the use of a namespace?


Namespaces are logical grouping of classes and other types in hierarchical structure.
Namespaces are useful to avoid collision or ambiguity among the classes and type names.
Another use of the namespace is to arrange a group of classes for a specific purpose.

Whats the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?


Visual Studio uses the Codebehind attribute to distinguish the page source or programming logic
from the design. Also the src attribute will make the page compile on every request. That is the page will
not be compiled in advance and stored in the bin as a dll instead it will be compiled at run time.

How many classes can a single .NET DLL contain?


It can contain many classes.

What methods are fired during the page load?


Init() - when the page is instantiated.
Load() - when the page is loaded into server memory.
PreRender() - the brief moment before the page is displayed to the user as HTML.
Unload() - when page finishes loading.

What is the difference between Value Types and Reference Types?


Value Types uses Stack to store the data.
where as Reference type uses the Heap to store the data.

What is web.config file?


Web.config file is the configuration file for the Asp.net web application. There is one web.config file for
one asp.net application which configures the particular application. Web.config file is written in XML

D. Harsha Vardhan

ASP.NET Interview Questions

with specific tags having specific meanings.It includes databa which includes connections,Session
States,Error Handling,Security etc.

What is the difference between in-proc and out-of-proc?


An Inproc is one which runs in the same process area as that of the client giving tha advantage of speed
but the disadvantage of stability becoz if it crashes it takes the client application also with it.
Outproc is one which works outside the clients memory thus giving stability to the client, but we have to
compromise a bit on speed.

What is a PostBack?
The process in which a Web page sends data back to the same page on the server.

Which control would you use if you needed to make sure the values in two different controls
matched?
CompareValidator is used to ensure that two fields are identical.

What is the difference between HTTP-Post and HTTP-Get?


The GET method creates a query string and appends it to the script's URL on the server that handles the
request.
The POST method creates a name/value pairs that are passed in the body of the HTTP request message.

What two properties should every Validation control have?


ControlToValidate and
ErrorMessage

D. Harsha Vardhan

ASP.NET Interview Questions

How to Manage State in ASP.Net?


There are several ways to manage a state.
ViewState
QueryString
Cookies
Session
Application

How big is the datatype int in .NET?


32 bits

How does ASP.NET work with the client and server machines?
ASP.NET uses client-side code to send messages back to the server. Thus, the server can be aware of
what's happening on the client.

How do you turn off cookies in one page of your asp.net application?
We may not use them at the max, However to allow the cookies or not, is client side functionality.

Whats the difference between Response.Write () and Response.Output.Write()?


Response.Outout.Write allows us to write the formatted out put.

What namespaces must you import to use data mechanisms in your ASP.NET pages?
System.Data, and optionally either System.Data.OleDb or System.Data.SQL. These provide additional
methods and objects that allow you to work with databases.

D. Harsha Vardhan

ASP.NET Interview Questions

What is the difference between page level caching and fragment caching?
In the page level caching, an entire Web page is cached; whereas, in the fragment caching, a part of the
Web page, such as a user control added to the Web page, is cached.

Which class deals with the users locale information?


System.Web.UI.Page.Culture

What are the different types of Caching?


There are three types of Caching :
Output Caching : stores the responses from an asp.net page.
Fragment Caching : Only caches/stores the portion of page (User Control)
Data Caching : is Programmatic way to Cache objects for performance.

Which template is to be provided in the Repeater control in order to display a data?


ItemTemplate
AlternatingItemTemplate.

What are the advantages of an assembly?


Increased performance.
Better code management and encapsulation.
It also introduces the n-tier concepts and business logic.

What is an ArrayList?
The ArrayList object is a collection of items containing a single data type values.

D. Harsha Vardhan

ASP.NET Interview Questions

What is the difference between a Thread and a Process?


A thread is a path of execution that run on CPU, a proccess is a collection of threads that share the same
virtual memory.
A process have at least one thread of execution, and a thread always run in a process context.

What's the difference between the Debug class and Trace class?
Documentation looks the same.
Use Debug class for debug builds.
use Trace class for both debug and release builds.

What is the top .NET class that everything is derived from?


System.Object

What is Marshalling?
Marshaling is a process of making an object in one process (the server) available to another process (the
client). There are two ways to achieve the marshalling.
Marshal by value
Marshal by reference.

What is a Static class?


Static class is a class which can be used or accessed without creating an instance of the class.

What is sealed class?


Sealed classes are those classes which cannot be inherited and thus any sealed class member can not be
derived in any other class.
A sealed class cannot also be an abstract class.

D. Harsha Vardhan

ASP.NET Interview Questions

What are the components of web form in ASP.NET?


Server controls
HTML controls
Data controls
System components.

How do you turn off cookies for one page in your site?
Use the Cookie. Discard Property which Gets or sets the discard flag set by the server. When true, this
property instructs the client application not to save the Cookie on the users hard disk when a session
ends.

What does assert () do?


In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if
the condition is false. The program proceeds without any interruption if the condition is true.

What is cookie less session? How it works?


By default, ASP.NET will store the session state in the same process that processes the request, just as
ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL.

What is the difference between Compiler and Interpreter?


Compiler:
A compiler is a program that translates program (called source code) written in some high level language
into object code. A compiler translates high-level instructions directly into machine language and this
process is called compiling.
Interpreter:
An interpreter translates high-level instructions into an intermediate form, which it then executes.
Interpreter analyzes and executes each line of source code in succession, without looking at the entire
program; the advantage of interpreters is that they can execute a program immediately.

D. Harsha Vardhan

ASP.NET Interview Questions

Where is View State information stored?


In HTML Hidden Fields.

What is role based security?


By default, ASP.NET will store the session state in the same process that processes the request, just as
ASP does. If cookies are not available, a session can be tracked by adding a session identifier to the URL.

What is the difference between Asp and Asp.net?


ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web
applications, ASP.NET is Managed compiled code - asp is interpreted. and ASP.net is fully Object
oriented.
ASP.NET has been entirely re-architected to provide a highly productive programming experience based
on the .NET Framework, and a robust infrastructure for building reliable and scalable web applications.

What is the base class of Asp.net?


System.Web.UI

What is use of web.config?


Web.config is used connect database from front end to back end.
Web.config is used to maintain the Appsettimgs instead of static variables.

What is RangeValidator?
RangeValidator - checks whether a value falls within a given range of number, date or string.

What is ValidationSummary?
ValidationSummary - It show a summary of errors raised by each control on the page on a specific spot
or in a message box.

D. Harsha Vardhan

ASP.NET Interview Questions

How do you indentify that the page is post back?


By checking the IsPostBack property. If IsPostBack is True, the page has been posted back.

What are the types of ASP Objects?


There are various types of Asp objects
Session Object
Application Object
Server Object
Request Object
Request Object
Response Object
Object Context
Error Object

What are remotable objects in .NET Remoting?


Remotable objects are the objects that can be marshaled across the application domains. You can
marshal by value, where a deep copy of the object is created and then passed to the receiver. You can
also marshal by reference, where just a reference to an existing object is passed.

What is the difference between ASP Session and ASP.NET Session?


Asp.net session supports cookie less session & it can span across multiple servers.

What is Difference between Namespace and Assembly?


Namespace is a logical design-time naming convenience, whereas an assembly establishes the name
scope for types at run time.

D. Harsha Vardhan

ASP.NET Interview Questions

What is the difference between early binding and late binding?


Calling a non-virtual method, decided at a compile time is known as early binding. Calling a virtual
method (Pure Polymorphism), decided at a runtime is known as late binding.

What is reflection?
All .NET compilers produce metadata about the types defined in the modules they produce. This
metadata is packaged along with the module (modules in turn are packaged together in assemblies),
and can be accessed by a mechanism called reflection.
The System.Reflection namespace contains classes that can be used to interrogate the types for a
module/assembly.

What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

What is a bubbled event?


When you have a complex control, like DataGrid, writing an event processing routine for each object
(cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the
main DataGrid event handler to take care of its constituents.

What is the differences between Server-side and Client-side code?


Server-side code executes on the server.
Client-side code executes in the clients browser.

D. Harsha Vardhan

ASP.NET Interview Questions

What is the difference between static or dynamic assemblies?


Assemblies can be static or dynamic.
Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the
assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable
executable (PE) files.
Dynamic assemblies, which are run directly from memory and are not saved to disk before execution.
You can save dynamic assemblies to disk after they have executed.

What are the difference between Structure and Class?


Structures are value type and Classes are reference type
Structures can not have constructor or destructors.
Classes can have both constructor and destructors.
Structures do not support Inheritance, while Classes support Inheritance.

What is the differences between dataset.clone and dataset.copy?


Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and
constraints.); however it doesnt copy the data.
Dataset.copy, copies both the dataset structure and the data.

What is datagrid?
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is
easy to use; you can display editable data in a professional-looking grid by setting only a few properties.
At the same time, the grid has a sophisticated object model that provides you with great flexibility in
how you display the data.

How do you hide the columns?


One way to have columns appear dynamically is to create them at design time, and then to hide or show
them as needed. You can do this by setting a columns Visible property.

D. Harsha Vardhan

ASP.NET Interview Questions

What are the difference between const and readonly?


A const cannot be static, while readonly can be static.
A const need to be declared and initialized at declaration only, while a readonly can be initialized at
declaration or by the code in the constructor.
A consts value is evaluated at design time, while a readonlys value is evaluated at runtime.

What is the difference between early binding and late binding?


Calling a non-virtual method, decided at a compile time is known as early binding.
Calling a virtual method (Pure Polymorphism), decided at a runtime is known as late binding.

What is Common Language Runtime?


CLR also known as Common Language Run time provides a environment in which program are executed,
it activate object, perform security check on them, lay them out in the memory, execute them and
garbage collect them.

What is Intermediate Language?


MSIL are also known as Microsoft Intermediate Language is the CPU-independent instruction set into
which .Net framework programs are compiled. It contains instructions for loading, storing initializing,
and calling methods on objects.

What is boxing and unboxing?


Implicit conversion of value type to reference type of a variable is known as BOXING, for example
integer to object type conversion.
Conversion of reference type variable back to value type is called as UnBoxing.

What is garbage collection?


Garbage collection is a system whereby a run-time component takes responsibility for managing the
lifetime of objects and the heap memory that they occupy.

D. Harsha Vardhan

ASP.NET Interview Questions

What is serialization?
Serialization is the process of converting an object into a stream of bytes.
Deserialization is the opposite process of creating an object from a stream of bytes. Serialization /
Deserialization is mostly used to transport objects.

What is the difference between Managed code and unmanaged code?


Managed Code: Code that runs under a "contract of cooperation" with the common language runtime.
Managed code must supply the metadata necessary for the runtimeto provide services such as memory
management, cross-language integration, code access security, and automatic lifetime control of
objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

Un-Managed Code: Code that is created without regard for the conventions and requirements of the
common language runtime. Unmanaged code executes in the common language runtime environment
with minimal services (for example, no garbage collection, limited debugging, and so on).

What is difference between constants, readonly and, static?


Constants: The value cant be changed.
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

What is Delegates?
Delegates are a type-safe, object-oriented implementation of function pointers and are used in many
situations where a component needs to call back to the component that is using it. Delegates are
generally used as basis of events, which allow any delegate to easily be registered for as event.

D. Harsha Vardhan

ASP.NET Interview Questions

What are different types of Assemblies?


Single file and multi file assembly.
Assemblies can be static or dynamic.
Private assemblies and shared assemblies.

What is a DataSet?
A DataSet is an in memory representation of data loaded from any data source.

What is the difference between System.String and System.Text.StringBuilder classes?


System.String is immutable.
System.StringBuilder was designed with the purpose of having a mutable string where a variety of
operations can be performed.

What are Cascading style sheets?


Cascading style sheets (CSS) collect and organize all of the formatting information applied to HTML
elements on a Web form. Because they keep this information in a single location, style sheets make it
easy to adjust the appearance of Web applications.

D. Harsha Vardhan

ASP.NET Interview Questions

You might also like