Sei sulla pagina 1di 70

ASP.

NET
ASP.NET is tool for creating web application and web services.

ASP.NET is server side scripting technology.

ASP.NET is a part of microsoft .net framework.

.NET Framework includes an execution engine called common language runtime, CLR and class library.

Like Asp, ASP.NET also runs inside IIS. It is tightly integrated with the microsoft server, programming, data
access, and security tools.

When browser requests an ASP.NET file, IIS passes the request to ASP.NET engine which after having
executed the script sends file back to browser as a simple HTML page.

ASP.NET is not backward compatible with classic ASP.

Unlike interpreted classic ASP, ASP.NET is compiled CLR code.

Being part of CLR, it has advantages of early binding, JIT compilation, caching services, garbage collection
etc.

ASP.NET uses ADO.NET for data access and is well integrated with VB.NET, C#.Net, Jscript etc.

ASP.NET provides two sets of controls - HTML and server control.

ASP.NET employs a text-based configuration settings and thus, server does't get restarted in case of
change in setting.

ASP.NET executes new code on request and thus, server restarts only when new code executes.

ASP.NET is part of the .NET framework and is made up of several components like Visual Studio .NET
Web development tools, System.Web namespaces, Server and HTML controls.

System.Web namespaces is the part of the .NET Framework that include classes.

Server and HTML controls are the two sets of user-interface components of ASP.NET

Advantages of ASP.NET
Executable of ASP.NET application is compiled that runs faster than interpreted scripts
Automatic state management for controls
Access to the .NET Framework
Introduction of VB.NET that is evolution version of VB
Fully supports object-oriented programming,
Can create new and customized server controls from existing controls
Built-in security through the windows server or other authentication/authorization methods
Integration with ADO.NET
Full support for XML and CSS
Built-in features for caching frequently requested web pages on the server.
Navigation sequence of ASP.NET web form
IIS starts the ASP.NET worker process that in turn, loads the assembly,
The assembly composes a response to the user and
IIS returns the response to the user in the form of HTML.

ASP.NET web form components


Server controls define the user interface of a Web form and built-in features for saving data.

HTML controls are visual element provided by HTML. They are useful when complete features of server
controls are not needed.

Data controls connect to SQL and OLE databases and XML data files.
Examples of such controls are SqlConnection, SqlCommand, OleDbConnection, OleDbCommand, DataSet.

System components provide access to various system-level events that occur on the server. Ex. EventLog,
MessageQueue.

.NET Framework includes an execution engine called CLR and class library.

Shared (VB.NET) or static members (C#) - These are class methods that can be used directly without first
creating an object from the class. These members can be called from the class name. Example of such
member is Math class.

Virtual folder: Web applications can exist only in a location that has been published by IIS as a virtual
folder. It is shared resource identified by an alias that represents a physical location on a server. The virtual
folder named //localhost is the web root folder on your computer. IIS determines the physical location of your
Web root folder. By default, IIS installs the folder on your root drive at \Inetpub\wwwroot.

View state: ASP.NET preserves data between requests using view state. View state is available only
within the web page.

State variable: It allows data entered on a web page available on other web pages in an application.
Application state variables: The value of these variables are available to all users of an application.
Session state variables: The value of these variables are available only to a single session (user).

Application event handlers in ASP.NET


Application_Start: occurs when first user visits a page.

Application_End: occurs when last user exit from the site.

Application_BeginRequest: occurs at the beginning of each request to the server.

Application_EndRequest: occurs at the end of each request to the server.

Session_Start: occurs when a new user visits a page within your application.

Session_End: occurs when a user stops requesting pages from the web application.

ASP.NET web form events


Page_Init: server controls are loaded and initialized.

Page_Load: server controls are loaded in the page object.

Page_PreRender: application is about to render the Page object.


Page_Unload: page is unloaded from memory.

Page_Disposed: page object is released from memory.

ASP.NET transaction events are


Page_AbortTransaction: occurs when transaction is aborted.

Page_CommitTransaction: occurs when transaction is accepted.

Page_DataBinding: occurs when server control on the page binds to a data source.

Server control events in ASP.NET


Postback events cause the web page to be sent back to the server for immediate processing. These events
have performance issue because they trigger a round-trip to the server.

Cached events save controls in the page’s view state to be processed when a postback event occurs.

Validation events occur before the page is post back to the server. .

Application domain: The process space where ASP.NET worker process loads the Web application’s
assembly.

Namespaces organizes code and provide protection from conflicting names (namespace collisions)

Access modifier for classes and modules


Public (VB.NET) or public (C#) can be accessed by all members in all classes and projects.

Friend (VB.NET) or internal(C#) can be accessed by all members in the current project

Protected (VB.NET) or protected(C#) can be accessed in the current class and in classes derived from this
member’s class

Protected Friend (VB.NET) or protected internal(C#) can be accessed by all members in the current project
and all members in classes derived from this member’s class

Private (VB.NET) or private(C#) can be accessed by members of the current class only

Inheritance: With this facility, base class provides methods, properties, and other members to a derived
class.

Abstract classes defines an interface for derived classes. Abstract classes are declared with the
MustInherit (in VB.NET) or abstract (in C#) keyword. Methods and properties of these classes are declared
as MustOverride (in VB.NET) or as abstract in C#.

Delegates are strong types function pointer used to invoke one or more methods where the actual method
invoked is determined at run time.

Interfaces are similar to abstract classes except interfaces don’t provide any implementation of class
members.

Global.asax: The Global object is defined in Global.asax that starts automatically when an application
starts. A developer can use events in global object to initialize application-level state variables.
Maintaining state information: Context.Handler, Query strings, Cookies, View state, Session state,
Application state.

Point to be considered for state variables: Maintaining session state affects performance and should be
turned off at the application and page levels when not required.

Application state variables are available throughout the current process, but not across processes. If an
application is scaled to run on multiple servers or on multiple processors within a server, each process has
its own application state. The web application’s boundaries determine the scope of the application state.

System.Web and System.Web.UI namespaces define most of the objects including Application, Page,
Request, and Response objects.

Server Controls vs. HTML Controls


Server controls trigger control events on the server whereas HTML controls can’t.

Server controls maintains data across requests but with HTML controls data is not maintained.

Server controls is provided with set of properties by .Net framework whereas HTML controls has attributes
only.

AutoPostBack property associated with each control which causes the control to fire postback event. By
default, this property is set to False.

ASP.NET List and Table Controls are ListBox, DropDownList, Table, DataGrid, DataList, Repeater.

The validation controls check the validity of data just before the page is posted back to the server, without
a round-trip to the server.

ASP.NET performs control validation on the client side just before posting the Web form back to the server.
Once client-side validation succeeds, the web form is validated again on the server side before the
Page_Load event occurs.

To open new window, we can use onclick=”window.open()” attribute. Web application supports client script
that runs on the client.

ASP.NET Validation Controls: RequiredFieldValidator, CompareValidator, RangeValidator,


RegularExpressionValidator, CustomValidator, ValidationSummary.

To use the validation controls, follow these steps:


Draw a validation control,

Set ControlToValidate or ControltoCompare property,

Set control’s ErrorMessage property,

Set validation control’s text property to show longer error message in a ValidationSummary.

Navigating between pages in ASP.NET


Hyperlink control,
Response.Redirect,
Server.Transfer is only for aspx page, end the currect page and begin executing the new one.
Server.Execute begins new one while still displaying the currect one.
Window.Open displays new browser window.
Layers to data access in ADO.NET
Physical data store: SQL, an OLE, or an Oracle database or an XML file.
Data provider: Connection and command objects that create in-memory representation of data
Data set: In-memory representation of the tables and relationships.
Data view: Presentation of a table in the data set use for filtering or sorting of data.

Types of database connection in ADO.NET: OleDbConnection, SqlConnection, OracleConnection.

Steps to access a database through ADO.NET


Create a connection using a connection object.

Invoke a command to create a DataSet object using an adapter object.

Use the DataSet object in code to display data or to change items in the database.

The database command object provides these three command methods: ExecuteScalar,
ExecuteNonQuery, ExecuteReader.

To establish database connection using command object


Create a connection to the database.

Open the connection.

Create a command object containing the SQL command or stored procedure to execute.

Execute the method on the command object.

Close the database connection..

Transactions is a set of database commands that are treated as a single unit.

Commands can be treated as transaction if


Atomic: Each command should perform single unit of work independently.

Consistent: All the relationships between data are maintained correctly.

Isolated: Changes made by other clients can’t affect the current changes.

Durable: Once a change is made, it is permanent.

Transaction processing follows these steps


Begin a transaction,

Process database commands,

Check for errors. If errors occurred, restore the database to its state at the beginning of the transaction,

If no errors occurred, commit the transaction to the database.

IsolationLevel property is the property of transaction objects that handles concurrent changes to a
database.

Isolation Level Settings


ReadUncommitted does not lock the records being read,
Chaos,

ReadCommitted locks the records being read and immediately frees the lock as soon as the records have
been read,

RepeatableRead locks the records being read and keeps the lock until the transaction completes,

Serializable locks the entire data set being read and keeps the lock until the transaction completes.

Exceptions are unusual occurrences in the code of application. Dealing with unusual occurrences is called
exception handling. Errors that are not handled are called unhandled exceptions.

Ways to handling exceptions in ASP.NET are


Exception-handling structures,
Error events,
Custom error pages.

Exception-Handling Keywords: Try/try, Catch/catch, Finally/finally, End Try and Throw/throw

Finally/finally: Free resources used within the Try/try section and process any other statements that must
run, whether or not an exception has occurred

Exception-Handling Error Events


Page_Error resides in the web form,

Global_Error resides in the Global.asax file,

Application_Error resides in the Global.asax file.

Server Object’s Exception-Handling Events


GetLastError
ClearError

Error pages can be .htm or .aspx where users are redirected when unhandled exception occurs.

We can define error page at two level: CustomErrors section of the Web.config file. ErrorPage attribute of
the Web form’s @ Page directive.

The customErrors mode attribute must be On to view the error pages. RemoteOnly (the default) means
error will be displayed at the client machine and not locally.

The page-level setting supersedes the application-level settings in the Web.config file.

Exception log provides a list of handled exceptions. Use the Throw/throw keyword to intentionally cause an
exception.

Tracing records events, a way to record errors by writing error message in the file.

Steps to use tracing in ASP.NET


Turn tracing on

Write to the trace log

Read the trace log


Tracing can be turned on or off for an entire Web application or for an individual page

For an entire application, set the element’s Enabled attribute to True in Web.config file.

For a single page, set the @ Page directive’s Trace attribute to True in the Web form’s HTML.

The Trace object provides the Write and Warn methods.

Messages written with Write are in black, whereas messages written with Warn are in red.

By default, trace output is displayed at the bottom of each Web page, if the element’s PageOutput attribute
is set to False in the Web.config file, otherwise written to the Trace.axd file.

By default, you can view Trace.axd only from the local server running the application.

To view the trace log from a remote machine, such as when debugging remotely, set the element’s
LocalOnly attribute to False in the Web.config file.

Users can be identified using Cookies. Cookies are small files that a web application can write to the
client. Cookies allow interaction with user invisibly. Users can set their browsers not to accept cookies.
Approaches when storing and retrieving user information through cookies: Store all the user information as a
cookie on the client’s machine. Store an identification key and retrieve user information from a data source
using key. .

Steps to store cookies in ASP.NET


Check if the client supports cookies by using the Browser object’s Cookies property.

Check if the cookie already exists by using the Request object’s Cookies collection.

Create a new cookie object using the HttpCookie class, if not exist.

Set the cookie object’s Value and Expiration properties.

Add the cookie object to the Response object’s Cookies collection.

Cookie object’s Expires property to Now – to delete Cookies

DllImport attribute to declare unmanaged procedures for use within .NET assemblies.

To hide public .NET members from COM, use the ComVisible attribute.

Mailto protocol to create a message that will be sent from the user’s mail system.

The Mailto protocol is used as part of a hyperlink.

MailMessage and SmtpMail classes are used to compose and send messages from the server’s mail
system.

Authentication is the process of identifying users.

Authorization is the process of granting access to authenticated users based on identity.

Access by anonymous users is the way most public web sites work allows anyone to view info.
ASP.NET web applications provide anonymous access by impersonation.

Impersonation is the process of assigning a user account to an unknown user.

By default, the anonymous access account is named IUSER_machinename.

Ways to authenticate and authorize users in ASP.NET


Windows authentication uses windows user list and privileges to identify and authorize users.

Forms authentication directs users to a logon web form that collects user name and password information,
and then authenticates the user against a user list or database that the application maintains.

Passport authentication directs new users to a site hosted by microsoft.

The FormsAuthentication class is part of the System.Web.Security namespace. Authenticate method of


this class checks the user name and password against the user list found in the element of Web.config.
RedirectFromLoginPage method of this class displays the application’s start page. Use the
FormsAuthentication class to sign out when the user has finished with the application.

Passport authentication identifies users via Microsoft Passport’s single sign-on service. The advantage of
Passport authentication is that the user doesn’t have to remember separate user names and passwords for
various web sites

IIS supports ways of encrypting and decrypting Web requests and responses.This cryptography
requires that you request an encryption key called a server certificate from an independent third party called
a certificate authority. The Secure Sockets Layer (SSL) is the standard means of ensuring that data sent
over the internet can’t be read by others. When a user requests a secure Web page, the server generates
an encryption key for the user’s session and then encrypts the page’s data before sending a response. On
the client side, the browser uses that same encryption key to decrypt the requested web page and to encrypt
new requests sent from that page.

Steps to be taken before deployment of application

Set the build options: Make the project compatible with an earlier Microsoft .NET. Select the Enable
Optimizations check box to make the compiled code smaller, faster, and more efficient. Disable integer
overflow checks:Allow classes to be used from the Component Object Model (COM).

Identify the application: To identify your application, open the AssemblyInfo file and enter the application’s
information.

Configure the application: Configuration files are Web.config and Machine.config.

The Machine.config file located in the Windows\Microsoft.NET\Framework\version\config directory.


Machine.config sets the base configuration for all .NET assemblies running on the server.

Web.config Attributes: Compilation, CustomErrors, Authentication, Authorization, Trace, SessionState,


Globalization.

The global assembly cache (GAC) is a special subfolder within the Windows folder that stores the
shared .NET components. When you open the folder, Windows Explorer starts a Windows shell extension
called the Assembly Cache Viewer (ShFusion.dll)

You can install strong-named .NET components by dragging them into the Assembly Cache Viewer, or by
using the Global Assembly Cache tool (GacUtil.exe).
Monitoring the Server: Windows provides MMC snap-ins for monitoring security, performance, and error
events.
Event Viewer snap-in: Lists application, system, and security events on the system.
Performance snap-in: Lets you create new events to display in the Event Viewer.

Tuning Deployed Applications

ProcessModel element’s attributes in the server’s Machine.config file: control the number of threads and the
time-out behavior etc.

Use the sessionState element’s attributes in the application’s Web.config file: control how session state
information is saved.

ProcessModel Attributes
Maximum number of requests to be queued, How long to wait before checking whether a client is
connected, How many threads to allow per processor etc.

Optimization Tips
Turn off debugging for deployed applications.

Avoid round-trips between the client and server.

Turn off Session state if it isn’t needed.

Turn off ViewState for server controls that do not need to retain their values. Use stored procedures with
databases.

Use SqlDataReader rather than data sets for read-forward data retrieval.

The ability to add capacity to an application is called scalability. ASP.NET Web applications support
this concept through their ability to run in multiple processes and to have those processes distributed across
multiple CPUs and/or multiple servers.

A Web application running on a single server that has multiple CPUs is called a Web garden and
application running on multiple servers is called a Web farm.

Web Garden Attributes in processModel are

webGarden: Set to “true” to run applications on more than one processor on this server.

cpuMask: Specifies which CPUs should run ASP.NET Web applications.

Multiple Servers
For multiple servers to handle requests for a single HTTP address, you need to install load balancing to your
network. Load-balancing services can be provided by hardware or software solutions.

Running a web application on multiple servers requires that you take special steps to handle application and
session state information. To share data across multiple sessions in a web garden or web farm, you must
save and restore the information using a resource that is available to all the processes. This can be done
through an XML file, a database, or some other resource using the standard file or database access
methods. You can share session state using: A state server, as specified by a network location. A SQL
database, as specified by a SQL connection.
ASP.NET Web applications also have a limited ability to repair themselves through process recycling.

Process recycling is the technique of shutting down and restarting an ASP.NET worker process
(aspnet_wp.exe) that has become inactive or is consuming excessive resources. You can control how
ASP.NET processes are recycled through attributes in the processModel element in the Machine.config file.

Types of Tests
Unit test, Integration test, Regression test, Load test (also called stress test), Platform test.

Web user controls combine one or more server or HTML controls on a Web user control page. User
controls create a single visual component that uses several controls. User controls can be used on Web
forms throughout a project. User controls are not compiled into assemblies.

Steps to create user control

Add a Web user control page (.ascx) to your project.

Draw the visual interface of the control in the designer.

Write code to create the control’s properties, methods, and events.

Use the control by dragging it from Solution Explorer to the Web form.

Use the control from a Web form’s code by declaring the control at the module level.

Composite custom controls combine one or more server or HTML controls composite custom compiles to
create an assembly (.dll)

Rendered custom controls are created almost entirely from scratch.

Caching

@OutputCache page directive caches a Web form in the server’s memory.

OutputCache directive has two required attributes: Duration and VaryByParam.

The VaryByParam attribute caches multiple responses from a single Web form. VaryByParam to None
caches only one response for the Web form.

XSL Transformations
XSL transformations generate formatted output from an XML input file. XSL positions elements anywhere on
the Web form. XSL performs logical operations like repeating and conditional operations. XSL places
structured data on a Web form.

Steps to perform an XSL transformation in ASP.NET

Add an XML server control to a Web form.

Set the control’s DocumentSource property to the XML file to format.

Set the TransformSource property to the XSL file to use to format the output.

Creating an XML File


XML files describe structured data in text format. XML identifies data items using … tags. Each item must
have a begin tag and an end tag. Item tag names are case sensitive. Attribute values must always be
enclosed in double quotation marks. The nested items must be terminated before the containing item is
terminated. The XML structure is strictly hierarchical. XML refers to the items in this hierarchy as XML
nodes. Nodes have parent-child relationships that are identified using the XPath.

Globalization Approaches in ASP.NET


Create separate web application corresponding to each culture, detect the culture and redirect to
appropriate application. Create single web application and adjust output at run time as per culture detected.
Create a single Web application that stores culture-dependent strings in resource files that are compiled into
satellite assemblies. At run time, detect the user’s culture and load strings from the appropriate assembly.

 C#.NET is a major component of Microsoft Visual Studio .NET suite.

 Being part of VS.net suite, C#.NET can access a common .NET library and supports all CLS
features.

 C#.NET is a complete object oriented language which supports inheritance, overloading, interfaces,
shared members and constructors.

 .Net Framework is a primary element for software development in VS.Net suite.

 .Net Framework includes loads of code required for application development.

 .Net Framework is divided into CLS (Common language Runtime) and base class library.

 CLS offers many service required for execution of application developed in .Net platform

 Base class library has many pre-developed classes that can be used by the developer.

 Base class library is organized into namespaces.

 Assembly is a primary unit of the .Net application.

 Assembly contains manifest which describes the assembly and its modules.

 Modules contain source code for the application.

 An assembly may exist in the form of either DLL or .Exe.

 An assembly is stored as an intermediate language (IL) file. Before running, the assembly goes
through security check against the local system. After having cleared from security check, it gets
loaded into memory and compiled into native code by JIT compiler.

 A variable in .Net can be of two types.

 Value type and reference type.

 Value type contains data of the type whereas reference type contains pointer to an instance of an
object of that type.

 Value type is created at the time of declaration whereas reference type must be instantiated after
declaration to create object.
 If we assign a reference type variable to another reference type variable, only reference to the
object is copied, not value and both the variable will refer to the same object.

 Use of 'using' keyword will allow to reference to the member of a namespace. Classes and
structures contain data and methods. Methods perform data manipulation and provide behavior to
classes and structures. Method can return values. The method which returns value is called as
function and which doesn’t return value is called as Subs.

 Method can have parameters that are passed by value by default. We can pass parameters by
reference with the ref keyword in C#.NET and byref in VB.NET.

 The constructor is like any method of the class, but gets created before the object is available for
use. This is the first method to get called on the instantiation of the class.

 The destructor is called just before an object is destroyed. It is used for code clean-up when object
is no longer in use. Developer has no control when a destructor is called, since it gets called by
CLR.

 .Net Framework provides utility like garbage collection.

 The garbage collection is responsible for automatic memory reclamation when object is no more in
use.

 The garbage collection is a low-priority thread that runs in the background of the application.

 The GC gets high priority when memory resource is scarce.

 We should remember that GC is called by CLR, so developer has no control when GC is called.
So, we shouldn’t rely on the code placed inside destructors or finalizers. If we need to reclaim
recourses urgently, we can use dispose () method which can be called explicitly.

 The GC also gets ride of circular references, commonly known as memory leak.

 Form is the basic unit of user interface. We can add form in the application at design time or run
time. We can create one general parent form and can inherit forms from parent form using visual
inheritance. While using visual inheritance, we ensures uniform look to all the forms of the
application.

 Forms have various properties that control their appearance, namely text, font, cursor, background
Image, Opacity, backcolor and forecolor.

 Forms have various intrinsic methods like Form.show, form.showdialog, form.activate, form.hide
and form.close.

 Form’s intrinsic methods cause changes in the visual interface and various events get raised like
load, activated/deactivate, visiblechanged, closing, closed.

 We can also create our own event handler which will get called when associated event is raised.

 Each control on the form can have order of navigation which can be set using tabindex property of
the control.
 A control can contain other controls. For example panel, groupbox and tabpage.

 We can resize and change position of the form and controls on it, manually. We can make use of
docking and anchor properties for automatic resizing and positioning of the controls as we change
size or position of the form.

 Dock property ensures the controls to an edge of the form on change in size or repositioning of the
form.

 Anchor property ensures if controls should be fixed, floats, or change size in response to the
change in size of form.

 We can create control at run-time by declaring control and instantiating of the type. We can then
add instantiated control to the control collection of the form.

 Each control’s property on the form can be enhanced by using Extender Provider component.
These properties mostly used to provide information to the user like help or tool tip.

 Menu is the best navigation way in the application. We can create MainMenu control that allows
rapid creating of menu for the application. Developer can apply separator bars, access keys and
shortcut keys.

 Context menu allows us to get access to various commands on the specific situation.

 Developer can create this kind of menu same as MainMenu but at run-time.

 We can control the menu dynamically at run-time. We can enable and disable the menu items,
make menu items invisible etc. We can change the structure of menu dynamically at run-time by
creating new menu with the CloneMenu method.

 We can have form-level validation as well as field level validations.

 We can validate each field as data entered using field-level validation.

 We can validate all fields of the form at one shot using form-level validation.

 The textbox control contains properties like MaxLength, PasswordChar, ReadOnly, Multiline. These
properties are used to restrict user to enter unwanted data in the field. Developer can tap keyboard
events of the control like Keydown, KeyUp and Keypress.

 Developer can validate character input by using static methods of char structure like char.IsDigit,
CharIsletter, Char.Islower, Char.IsUpper etc.

 The CauseValidation property of the control allows us to disable the event to occur. The event
occurs only when CauseValidation property of the control is set to true.

 We can set CancelEventArgs.Cancel property to true in the event handler to restrict focus from
moving away from the control.

 The ErrorProvoider component of the control can be used at run time for displaying informative
error message to the user.
What is AppSetting Section in “Web.Config” file?

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.........
Read answer

Difference between Server.Transfer and response.Redirect.

Latest answer: Following are the major differences between them: Server.Transfer - The browser is directly
redirected to another page. There is no round trip...........
Read answer

Difference between authentication and authorization.

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..............
Read answer

What is impersonation in ASP.NET?

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.............
Read answer

What is event bubbling in .NET?

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..........
Read answer

Describe how the ASP.NET authentication process works.

Latest answer: ASP.NET runs inside the process of IIS due to which there are two authentication layers
which exist in the system.............
Read answer

Explain the ways of authentication techniques in ASP.NET

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:.........
Read answer

Windows authentication.

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............
Read answer
Passport authentication

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.............
Read answer

Forms authentication

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. ............
Read answer

Explain how authorization works in ASP.NET

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: ...........
Read answer

Difference between Datagrid, Datalist and repeater.

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...........
Read answer

What are the events in GLOBAL.ASAX file?

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.............
Read answer

What are different IIS isolation levels supported in ASP.NET?

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............
Read answer

Difference between Gridlayout and FlowLayout.

Latest answer: GridLayout provides absolute positioning for controls placed on the page. FlowLayout
positions items down the page like traditional HTML.........
Read answer

What is Authentication in ASP.NET?

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.......
Read answer
What is Authorization in ASP.NET?

Latest answer: Authorization is a process that takes place based on the authentication of the user.......
Read answer
Explain the concept of Automatic Memory Management in ASP.NET.

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..........
Read answer

What is Finalizer in .NET?

Latest answer: Finalizer in .NET are the methods that help in cleanup the code that is executed just before
the object is garbage collected..............
Read answer

Explain the types of cookies in ASP.NET.

Latest answer: There are two types of cookies in ASP.NET -Single valued cookies................
Read answer

What are the ways to retain variables between requests?

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...........
Read answer

Describe the Cookies collection in ASP.NET.

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.............
Read answer

What is the Common Language Specification (CLS)?

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................

ASP.NET interview questions - part 1


Next>>

What is the difference between login controls and Forms authentication?

Latest answer: Login control provides form authentication. If we implement for authentication through form
authentication then we do it through code. On the other hand, login control allows the easy
implementation...............
Read answer

What is Fragment Caching in ASP.NET?

Latest answer: Fragment caching allows to cache specific portions of the page rather than the whole page.
It is done by implementing the page in different parts............
Read answer

What is partial classess in .net?

Latest answer: When there is a need to keep the business logic separate from the User Interface or when
there is some class which is big enough to have multiple number of developers............
Read answer

Explain how to pass a querystring from an .asp page to aspx page.

Latest answer: FromHTMLinasppage:<ahref="abc.aspx?qstring1=test">Test Query String</a>


From server side code: <%response.redirect "webform1.aspx?id=11"%>...............
Read answer

What is a ViewState?

Latest answer: If a site happens to not maintain a ViewState, then if a user has entered some information in
a large form with many input fields and the page is refreshes, then the values filled up in the form are
lost...........
Read answer

What is the difference between src and Code-Behind?

Latest answer: With the ‘src’ attribute, the source code files are deployed and are compiled by the JIT as
needed.
Though the code is available to everyone with an access to the server (NOT anyone on the web)................
Read answer

What is the difference between URL and URI?

Latest answer: A URL (Uniform Resource Locator) is the address of some resource on the Web. A
resource is nothing but a page of a site. There are other type of resources than Web pages, but that's the
easiest conceptually...........
Read answer

What is the Pre-Compilation feature of ASP.NET 2.0?

Latest answer: Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then
cached so as to make the requests to access the page extremely efficient............
Read answer

How can we create custom controls in ASP.NET?

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
What is an application domain?

Latest answer: It's a way in CLR to maintain a boundary between various applications to ensure that they
do not interfere in working of any other application...........
Read answer

Explain the two different types of remote object creation mode in .NET. [Hint SAO and CAO]

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

Describe SAO architecture of Remoting.

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

Explain Singleton architecture of Remoting.

Latest answer: Singleton architecture is to be used when all the applications have to use or share same
data...........
Read answer

Define LeaseTime, SponsorshipTime, RenewOnCallTime, LeaseManagePollTime.

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

Briefly explain how to specify remoting parameters using config files.

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

What is marshalling? Explain types of marshalling.

Latest answer: Marshaling is a process of transforming or serializing data from one application domain and
exporting it to another application domain...........
Read answer

What is ObjRef object in remoting?

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

Explain the steps of acquiring a proxy object in web services.


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

Explain the steps to create a web services and consume it.

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

Explain the difference between cache object and application object.

Latest answer: Application Object: Application variable/object stores an Object with a scope of availability
of the entire Application unless explicitly destroyed.............
Read answer

What is Cache Callback in Cache?

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

What is Scavenging?

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

Explain the types of Caching using Cache object of ASP.NET.

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

Show with an example how to Cache different version of same page using ASP.NET Cache object.

Latest answer: The ways to cache different versions on the same page using ASP.NET cache object is
using OutputCache object............
Read answer

Explain how to implement Fragment Cache.

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

Explain the various modes of storing ASP.NET session.


Latest answer: Types of sessions: InProc: The default way to use sessions. InProc is the fastest way to
store and access sessions...........
Read answer

What are the benefits and limitations of using hidden fields?

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

What are the benefits and limitations of using Hidden Frames?

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

What are benefits and limitations of using Cookies?

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

What is QueryString and what are benefits and limitations of using querystring?

Latest answer: Querystring is way to transfer information from one page to another through the URL........
Read answer

What is Absolute and Sliding expiration in .NET?

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

Explain the concepts and capabilities of cross page posting.

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

Explain how to access ViewState value of this page in the next page.

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

What is SQL Cache Dependency in ASP.NET?

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

Explain the concepts of Post Cache Substitution in .NET


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

Explain the use of localization and Globalization.

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

Explain the concepts of CODE Page approach. What are the disadvantages of this approach?

Latest answer: Code Page was used before Unicode came into existence. It was a technique to represent
characters in different languages..........
Read answer

What are resource files and explain how do we generate resource files?

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

What are Satellite assemblies and how to generate Satellite assemblies?

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

Define AL.EXE and RESGEN.EXE.

Latest answer: Al.exe: It embeds the resources into a satellite assembly. It takes the resources in
.resources binary format.......
Read answer

Explain the concepts of resource manager class.

Latest answer: ResourceManager class: It provides convenient access to resources that are culture-
correct. The access is provided at run time.........
Read answer

What is Windows communication foundation, WCF?

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

Explain the important principle of SOA.

Latest answer: A service-oriented architecture is collection of services which communicate with one
another other......
Read answer
Explain the components of WCF - Service class, Hosting environment, END point.

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

Difference between WCF and Web Services.

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

What are different bindings supported by WCF?

Latest answer: BasicHttpBinding, WSHttpBinding, WSDualHttpBinding.......


Read answer

What is duplex contract in WCF?

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

Explain the different transaction isolation levels in WCF.

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

What are Volatile and Dead letter queues?

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

What is Windows workflow foundation?

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

Explain the types of Workflow in Windows Workflow Foundation.

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

What are XOML files? Explain their uses.

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

How to make an application offline in ASP.NET 2.0.

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

What are script injection attacks?

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

What is Authentication in ASP.NET?

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

What is Authorization in ASP.NET?

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

What is the difference between login controls and Forms authentication?

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

What is Fragment Caching in ASP.NET?

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

What is partial classess in .net?

.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

Explain how to pass a querystring from an .asp page to aspx page.

Yes you can do it using a hyperlink< BR><ahref="Abc.aspx?name=test">Click to go to aspx </a>.............


Read answer

Overview of the .NET Compact Framework


.NET Compact Framework is a scaled down versions of .NET framework for supporting Windows CE based
mobile and embedded devices like mobile phones...............

What is Language Integrated Query (LINQ)?

LINQ is a set of extensions to .NET Framework that encapsulate language integrated query, set and other
transformation operations...................

Define access modifiers.

Access modifiers are used to control the scope of type members.


There arefive access modifiers that p rovide varying levels of access...........
Read answer

Name the namespace for Web page in ASP.NET.

System.Web.UI.Page..........
Read answer

Write difference between overloading and overriding.

Overriding - Methods have the same signature as the parent class method............
Read answer

Write namespace for user locale in ASP.NET.

System.Web.UI.Page.Culture............
Read answer

How do you implement inheritance in .NET?

In C#.NET, we implement using ":"


In VB.Net we implements using "Inherits" keyword...........
Read answer

Explain the differences between Server-side and Client-side code.

Server-side code executes on the server.


Client-side code executes in the client's browser..........
Read answer

Define ADO.NET Dataset.

A Dataset can represent an entire relational database in memory, complete with tables, relations, and
views...............
Read answer

Define global.asax in ASP.NET.

The Global.asax is including the Global.asax.cs file.


You can implement application........
Read answer
What are the Application_Start and Session_Start subroutines used for?

These subroutines set the variables for the Application and Session objects.........
Read answer

Define inline code and code behind.

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

What is MSIL?

MSIL is the Microsoft Intermediate Language.


.NET compatible application will get converted to MSIL on compilation...........
Read answer

Name the class Web Forms inherit from.

The Page class...........


Read answer

Explain different IIS isolation levels in ASP.NET- Low (IIS process A), Medium (Pooled), High
(Isolated)

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...........

What is Shared (static) member?

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

What is the transport protocol you use to call a Web service?

SOAP (Simple Object Access Protocol) is the preferred protocol................


Read answer

What is Option Strict used for?

Option Strict On enables type checking at design time and prevents.............


Read answer

Define Boxing an Unboxing.

Boxing allows you to treat a value type the same as a reference type........
Read answer

What does WSDL stand for?


Web Services Description Language..........
Read answer

Define ViewState in ASP.NET.

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

What is the lifespan for items stored in ViewState?

Items stored in the ViewState exist for the life of the current page...........
Read answer

Define EnableViewState property.

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

What are Delegates?

Delegates provide the functionality behind events.


A delegate is a strongly typed function pointer................
Read answer

What are Classes?

Classes are the blueprints for objects.


A class acts as a template for any number of distinct objects.........
Read answer

What is Encapsulation?

The data of an object should never be made available to other objects...........


Read answer

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.............
Read answer

What methods are fired during the page load?

Init() - when the page is instantiated.


Load() - when the page is loaded into server memory.........
Read answer

Explain ADO.NET.
It is data-access technology, primarily disconnected and designed to provide efficient, scalable data
access. The disconnected data is represented within a DataSet object.............

Define Server-side and Client-side code in ASP.NET.

Server-side code runs on the server.Client-side code runs on the client's browser................
Read answer

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

<asp:HyperLinkColumn>.............
Read answer

Where does VS.NET store Web application projects?

Web application projects create a virtual folder for each project where all the files of the projects are
stored.........
Read answer

Describe Web application’s life cycle.

A Web application starts with the first request for a resource. On request, Web forms are instantiated and
processed in the server...........
Read answer

Define class module and a code module.

Steps to execute a stored procedure from Web Application.

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

Describe exception handling in ASP.NET.

Exception handling correct unusual occurrences and prevent application from getting terminated.........
Read answer

What are the exception-handling ways in ASP.NET?

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..........

Describe 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.............

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.

The truth is that ASP.NET has several issues that need to be addressed:

 Round trips — The server events in ASP.NET require round trips to the server to process these
events. These round trips result in all form elements being sent between client and server as well
as images and other data files being sent back to the client from the server. Though some web
browsers will cache images, there can still be significant data transfer.
 Speed/network data transfer — Because of the ViewState hidden form element, the amount of data
that is transferred during a postback is relatively large. The more data and controls on the page, the
larger the ViewState will be and the more data that must be processed on the server and
transmitted back to the client.
 Waiting on the result — When a user clicks a button or some other visual element that posts back
data to the server, the user must wait for a full round trip to complete. This takes time when the
processing is done on the server and all the data, including images and ViewState, are returned to
the client. During that time, even if the user attempts to do something with the user interface, that
action is not actually processed on the client.
 User context — Unless an application is able to properly use the SMARTNAVIGATION feature of
ASP.NET, the user is redirected to the top of a page by default on a postback. Though there are
ways around this issue, this is the default behavior.
 Processing — The number of server round trips, amount of data that is transferred, and the
ViewState element’s size result in processing on the server that is not really necessary.

Users typically do something, data is sent to the server, the web server processes it, and the result is finally
sent to back to the user. While the server is processing the data, the user interface is “locked” so that
additional operations don’t happen until a result is returned to the user.

Improving the User Experience

Based on the preceding issues, several options are available for improving the user experience:

 Java — Java applets are cross-platform applications. While being used as a cross-platform
mechanism to display data and improve the user experience, Java development on the client has
not been accepted with open arms by the development community and is primarily used for user
interface gee-whiz features as opposed to improving the experience of the user application. (As a
side note, Java has been widely accepted for building server-side applications.)
 XML-based languages — XML User Interface Language (XUL) and Extensible Application Markup
Language (XAML) are two of several languages that can provide an improved user experience.
The problem with XUL is that it has been used only in the Mozilla/Firefox line of browsers.
Silverlight (formerly WPF/e), an associated product, is an interpreter for a subset of XAML.
Currently, there is support for Silverlight on Windows and the Apple Macintosh.
 Flash — Although Flash has been used and there are cross-platform versions, the product has
been used only in the area of graphic UI needs and has not been accepted by the development
community as a whole for building line of business applications. Recently, Adobe has released a
pre-release version of an Internet technology referred to as Apollo. Apollo is a runtime that allows
web skillsets to be used to develop rich desktop applications.
 AJAX — AJAX is a set of client technologies that provide for asynchronous communication
between the user interface and the web server, along with fairly easy integration with existing
technologies.

Given the amount of recent discussion among developers regarding AJAX, it appears that AJAX has the
greatest chance among these technologies of gaining market acceptance.

Current Drivers

Interest in web-based development has grown over the past few years. With that interest, Microsoft has
gone from classical ASP to ASP.NET development. ASP.NET development has grown to the point that it is
the most popular development platform for web-based applications. Even with its popularity, it has to
continually improve or it will get left in the dust of a more modern technology.

Over the past few years, building client-side web-based applications has grown in popularity. Users have
liked the applications because of the increased client-side functionality, such as keeping a common user
context during a “post” to the server and drag-and-drop features common to typical client applications. This
functionality was popularized by several applications from Google, including Gmail, Google Suggest, and
Google Maps.

In February 2005, this functionality got the name Asynchronous JavaScript And XML (AJAX) thanks to an
essay by Jesse James Garrett. At about this time, several .NET libraries started to show up. These libraries
hid many of the complexities of interfacing with web services and allowed developers to concentrate on the
application as opposed to creating the plumbing to talk to the web services.

ASP.NET needs to add this functionality. The question becomes, how does one add client-side functionality
to a development methodology that is mostly a server-side technology?

From a network standpoint, these applications are more efficient because they communicate back only the
necessary pieces of information and get back only the necessary updates from the server. From a web
server standpoint, these applications tend to use less CPU on the server. As a result, these types of
applications are highly desirable.

The next web development methodology from Microsoft was Active Server Pages (ASP). ASP was a
scripting environment that allowed developers to work with a Visual Basic–like or JavaScript-type
environment. Unfortunately, this type of environment came with several problems:

 Prevalence of spaghetti code — ASP code does not provide a structured development
environment, often contributing to the creation of twisted and tangled “spaghetti code.” ASP code is
literally a file with some basic configuration information at the top of every page. Each page is
executed from the top of the page to the bottom of the page. Although it is possible to use
Component Object Model (COM) objects to eliminate some of the spaghetti code, this introduces
more complexity in the form of another development tool.

 Lack of code separation — The code tends to be intermixed with display code. Intermixing the
code and the display logic requires that the tools developers and designers use work well together.
This was often not the case. For example, it was well known that various visual development tools
could take a properly running ASP page, rearrange some of the code, and render the ASP page
broken.
 Lack of code reusability —There is very little ability to reuse code within the ASP environment.
Code reusability in classic ASP is a function of providing logic in the form of COM objects, as
opposed to something within the ASP environment.
 Lack of debugging support — Debugging an ASP application typically involves the use of
Response.Write. This is in sharp contrast to an integrated development environment (IDE)
developed within a GUI environment.
 Problems of COM — ASP is based on the Component Object Model and suffers from many of the
problems associated with COM. There were two major problems with COM:

The first was that updating COM objects tended to overwrite one object with the new one.
This could be problematic if a programming method call changed or any other new behavior was
introduced. The second major problem with COM was that it was a binary standard. This binary
standard was based on a 32-bit programming model. As a result, COM objects would not scale up
to run natively within an environment that was an Intel-based, 64-bit environment. Although this
might not have been a big deal in the early to middle 1990s when COM was designed and built, by
the early 2000s and the introduction of inexpensive 64-bit systems, this was seen as a possible
bottleneck.
 Problems with being interpreted —ASP is interpreted. Each time an ASP file is loaded, the ASP
environment parses the ASP file, compiles the code, and then executes the file. This process is
repeated on each call to an ASP file. The result is wasted processing on the server.
 Presence of the state machine—ASP applications typically have a state machine at the top of
every ASP page that processes the state of the user and then displays code. (In software code, a
state machine is a section of code that depends on both its direct inputs and inputs made during
previous calls.) Given that most client-side applications are built based on events, which is a similar
concept to a state machine, this is an unfamiliar way to develop for those not well versed in ASP.

After getting feedback from developers, Microsoft developed ASP.NET, which greatly simplifies the web
development methodology:

 Developers no longer need to worry about processing state. With ASP.NET, actions are performed
within a series of events that provide state machine-like functionality.
 With the use of a code-behind/beside model, code is separated from display. By separating code
and display files, there is less of a chance of designer and developer tools interfering with each
other.
 A single development tool may be used for building the application and business logic. By having a
single integrated development suite, developers are able to more easily interact with the application
logic. This results in more code reuse and fewer errors.
 With the Visual Studio 2005 IDE, ASP.NET supports many methods to debug and track a running
ASP.NET application.
 Because ASP.NET is based on the common language runtime (CLR) and .NET, ASP.NET does
not suffer from the versioning problems of COM. The .NET framework allows for multiple versions
of components to be on a system without their interacting with each other.
 ASP.NET is compiled. The first time that a file is loaded, it is compiled and then processed. The
compiled file is then saved into a temporary directory. Subsequent calls to the ASP.NET file are
processed from the compiled file. The execution of the compiled file on requests is faster than the
interpreted environment of classic ASP.
All in all, ASP.NET is a dramatic improvement over ASP and has become widely accepted in the
development community.

ASP.NET application life cycle and events processing

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.

Explain the ASP.NET page lifecycle.

Lifecycle of a page in ASP.NET follows following steps:

Page_Init(Initialization of the page) >> LoadViewState(loading of View State) >> LoadPostData(Postback


data processing) >> Page_Load(Loading of page) >> RaisePostDataChangedEvent(PostBack change
notification) >> RaisePostBackEvent (PostBack event handling) >> Page_PreRender (Page Pre Rendering
Phase) >> SaveViewState (View state saving) >> Page_Render (Page rendering) >> Page_UnLoad (Page
unloading)

ASP.NET server control events


ASP.NET web form supports many server controls like Button, TextBox etc. Each control has associated
events. There are three types of server control events.

Postback event
Cached event
Validation event

Postback event

This event sends the page to server for processing. This causes the page a round-trip to the server.

Cached event

This event stores page data that gets processed when page is submit to the server by postback event.
Validation event

This event is handled on the page just before the page is posted back to server.

The order of server control events on a Web form is below.

First validations Event occurs just before the page is submitted to the server.
Postback Event occurs that cause the page to be submitted to the server.
Page_Init and Page_Load events are handled.
Cached events are handled.
Lastly, the event that caused the postback is processed.

ASP.NET server controls vs. HTML controls


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.

The ASP.NET DataList Control

The DataList control like the Repeater control is a template driven, light weight control, and acts as a
container of repeated data items. The templates in this control are used to define the data that it will contain.
It is flexible in the sense that you can easily customize the display of one or more records that are displayed
in the control. You have a property in the DataList control called RepeatDirection that can be used to
customize the layout of the control.

The RepeatDirection property can accept one of two values, that is, Vertical or Horizontal. The
RepeatDirection is Vertical by default. However, if you change it to Horizontal, rather than displaying the
data as rows and columns, the DataList control will display them as a list of records with the columns in the
data rendered displayed as rows.

This comes in handy, especially in situations where you have too many columns in your database table or
columns with larger widths of data. As an example, imagine what would happen if there is a fi eld called
Address in our Employee table having data of large size and you are displaying the data using a Repeater, a
DataGrid, or a GridView control. You will not be able to display columns of such large data sizes with any of
these controls as the display would look awkward. This is where the DataList control fits in.
In a sense, you can think the DataList control as a combination of the DataGrid and the Repeater controls.
You can use templates with it much as you did with a Repeater control and you can also edit the records
displayed in the control, much like the DataGrid control of ASP.NET. The next section compares the
features of the three controls that we have mentioned so far, that is, the Repeater, the DataList, and the
DataGrid control of ASP.NET.

When the web page is in execution with the data bound to it using the Page_Load event, the data in the
DataList control is rendered as DataListItem objects, that is, each item displayed is actually a DataListItem.
Similar to the Repeater control, the DataList control does not have Paging and Sorting functionalities built
into it.

Using the DataList Control

To use this control, drag and drop the control in the design view of the web form onto a web form from the
toolbox.

Refer to the following screenshot, which displays a DataList control on a web form:

The following list outlines the steps that you can follow to add a DataList control in a web page and make it
working:

1. Drag and drop a DataList control in the web form from the toolbox.
2. Set the DataSourceID property of the control to the data source that you will use to bind data to the
control, that is,
you can set this to an SQL Data Source control.
3. Open the .aspx fi le, declare the element and defi ne the fi elds as per your requirements.
4. Use data binding syntax through the Eval() method to display data in these defi ned fi elds of the control.

You can bind data to the DataList control in two different ways, that is, using the DataSourceID and the
DataSource properties. You can use the inbuilt features like selecting and updating data when using the
DataSourceID property. Note that you need to write custom code for selecting and updating data to any data
source that implements the ICollection and IEnumerable data sources. We will discuss more on this later.
The next section discusses how you can handle the events in the DataList control.

ASP.NET Application and Session state variables


Application state variables
Session state variables
Point to be noted about Application and Session state variables

By default, ASP.NET maintains page data between the requests using mechanism called View state. Every
web form has view state property to retain data. The form's view state can retain data only in that form. So,
when you need one form data in other form, you can't rely on view state. ASP.NET provides state variables
in the Application or Session objects that helps in maintaining state of the form which can be accessed in
other form.

Application state variables

The data stored in these variables is available to all the users i.e. all the active sessions.

Session state variables

These are available to the single session who has created the variables.

Point to be noted about Application and Session state variables

These variable can store any type of data.


Maintaining Session state affects performance.
Session state can be turned off at the application and page levels.
Application state variables are available throughout the current process, but not across processes.

Navigation methods in ASP.NET


Hyperlink control
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open method
Explain the difference between Server.Transfer and response.Redirect.

By Nishant Kumar

ASP.NET supports following ways to navigate between pages in your application.

Hyperlink control

This is server control use for navigation to another page specified in the NavigateURL property. Hyperlink
control doesn’t expose any server side event.

Response.Redirect method

This method is used to navigate to another page from code. You can use this method to navigate from a
Linkbutton or ImageButton control.
For example

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


LinkButton1.Click
Response.Redirect("Page2.aspx")
End Sub

Server.Transfer method

This method can be used only with .aspx file. It allows to retain some information between the requests when
its preserveForm argument is set to true.

Server.Execute method

Like Server.Transfer, this method is also used with .aspx file only. This method enables new page execution
while still displaying the current web form.

Window.Open method

Display a page in a new browser window on the client.

Server.Transfer and response.Redirect - October 30, 2008 at 18:10 pm by Amit Satpute

Explain the difference between Server.Transfer and response.Redirect.

Redirect and Transfer both cause a new page to be processed. The difference lies in the way the interaction
between the client and the server occurs.

Response.Redirect messages the client browser asking it to request for another page.
e.g. if a browser is on page A which has a Response.Redirect, then it asked to request for another page B by
the server. When the client browser requests for it, then it is provided with the requested page B.

With Server.Transfer, the browser is not requested to ask for another page. Instead it is directly provided with
the page B. In this scenario, the browser address bar continues to show the address of the previous URL.

State management in ASP.NET


Define state management in ASP.NET.

State management is implemented in order to retain information about the user requests.
Web pages are stateless. Each request creates new page without retaining any previous
information about the user requests...............
Read answer

Define Client-side state management and Server-side state management.

Client-side state management


This maintains information on the client's machine using Cookies, View State, and Query
Strings..........
Read answer

<<Previous Next>>
What is Session Identifier?
Advantages and disadvantages of using Session State Management.
What are the Session State Modes? Define each Session State mode supported by
ASP.NET.

ASP.NET Exception Handling Interview questions with answers

Define Exception handling in ASP.NET. | What are the ways of handling exceptions in ASP.NET? | Explain
Try/catch block method of exception handling. | Define Error Events. Define Custom Error Pages. | Why is
exception handling important to an application? | When can you use tracing with exception handling?

ASP.NET Master Pages questions with answers

What is Master Page in ASP.NET? | Advantages of using Master Page in ASP.NET | Define Multiple Master
Page. | How do you create Master Page?

What Is ASP.NET 2.0 AJAX?

ASP.NET 2.0 AJAX is an AJAX-oriented .NET library that runs on .NET 2.0. Though ASP.NET 2.0 AJAX is
an AJAX library and can be used to perform AJAX operations, it is really much more. ASP.NET 2.0 AJAX
offers many of the same types of features of the server-side ASP.NET............

The components in the ASP.NET 2.0 AJAX packaging

The packaging of ASP.NET 2.0 AJAX can be fairly confusing. The basics of the packaging are................

AJAX Benefits

AJAX offers benefits to both end users and developers. For end users, it reduces the “rich or reach” conflict;
for developers, it helps in overcoming the constraints raised by HTTP.............

What Is ASP.NET AJAX?

ASP.NET AJAX is the name of Microsoft’s AJAX solution, and it refers to a set of client and server
technologies that focus on improving web development with Visual Studio. Other companies have their own
AJAX solution, often taking a radically different approach..........

AJAX Libraries

In addition to ASP.NET AJAX, many third-party AJAX libraries are available that can be used with ASP.NET,
although not all of them were specifically designed for it. Some are mostly focused on providing JavaScript
libraries for use from within the browser to make manipulation of the browser DOM (Document Object
Model) easier..................

What is AppSetting Section in “Web.Config” file?

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.........

Difference between Server.Transfer and response.Redirect.

Following are the major differences between Server.Transfer and response.Redirect.....


ASP.NET caching technique
Define Caching in ASP.NET.

Caching technique allows to store/cache page output or application data on the


client...............
Read answer

Advantages of Caching

It increases performance of the application by serving user with cached output. It


decreases server round trips for fetching data from database by persisting data in the
memory.............
Read answer

What are the types of Caching in ASP.NET?

Caching in ASP.NET can be of the following types


Page Output Caching, Page Fragment Caching, Data Caching..............

ASP.NET exception handling technique


Define Exception handling in ASP.NET.

Exceptions or errors are unusual occurrences that happen within the logic of an
application...............
Read answer

What are the ways of handling exceptions in ASP.NET?

There are three ways to handle exceptions in ASP.NET


Try/catch/finally block..............
Read answer

Explain Try/catch block of exception handling.

You can enclose code in Try/Catch/Finally block. You can catch all exceptions in the
catch block..............
Read answer

Define Error Events.

ASP.NET supports events that occur when any unhandled exception occurs in an
application. These events are called as Error Events.............. Read answer

Define Custom Error Pages.


There are many errors that can’t be trapped in the application code like page not found. To intercept this
kind of error, ASP.NET supports Custom Error Pages that can be specified at two places..............
Read answer

Why is exception handling important for an application?

Exception handling is used to prevent application from being stuck due to unusual occurrences. If the
exceptions are handled properly, the application will never get terminated abruptly..............
Read answer

When can you use tracing with exception handling?

You can use tracing with exception handling to log unanticipated exception to the trace log. The log file can
be used to diagnose unanticipated problems and thus can be corrected..............

ASP.NET Master Pages

What is Master Page in ASP.NET?

A Master page offers a template for one or more web forms. It defines placeholders for the
content, which can be overridden by the content pages. The content pages contains only
content.............
Read answer

Advantages of using Master Page in ASP.NET

Master pages enables consistent and standardized layout to the website.


You can make layout changes of the site in the master page instead of making change in
the pages...............
Read answer

Define Multiple Master Page.

In ASP.NET, you can have multiple master pages each for a different purpose. You can
provide users several layout options using Multiple Master Page..............
Read answer

How do you create Master Page?

Steps to create Master Page

Right-click your web project in the Solution Explorer window


Select Add New Item. Select the Master Page item type from the Add New Item
dialog.................

ASP.NET resources
Define Authentication and Authorization.

Authentication is the process of verifying user's identity. Authorization is the process of


granting privilege to authenticated user. The user is validated using authenticated process
and then the authorization process identifies if the user has access to a given
resource.................
Read answer

What is the authentication mode available in ASP.NET?

ASP.NET supports three authentication modes through the System.Web.Security


namespace. Windows Authentication: The windows authentication authenticates users
based on their windows accounts. In short, it uses windows network security. It uses IIS to
perform authentication...................
Read answer

How do you set authentication mode in the ASP.NET application?

You can set authentication mode using web.config file.


<authentication mode="windows">
<authentication mode="passport">
<authentication mode="forms">.................
Read answer

List out the difference between windows authentication and form authentication.

Windows authentication uses windows account whereas form authentication maintains its
own user list. Windows authentication is best suited for the application which is meant for
a corporate users..............
Read answer

How do you impersonate the authenticated user in ASP.NET?

Impersonation means delegating one user identity to another user. In ASP.NET, the anonymous users
impersonate the ASPNET user account by default...............
Read answer

How do you provide secured communication in ASP.NET?

ASP.NET provides secured communication using Secure Sockets Layer. The application to use SSL need to
have an encryption key called a server certificate configured in IIS................

ASP.NET Session state management


Define Session, SessionId and Session State in ASP.NET.
A session is the duration of connectivity between a client and a server
application...............
Read answer

What is Session Identifier?

Session Identifier is used to identify session. It has SessionID property. When a page is
requested, browser sends a cookie with a session identifier..............
Read answer

Advantages and disadvantages of using Session State.

The advantages of using session state are as follows:


It is easy to implement.
It ensures data durability, since session state retains data even if ASP.NET work
process..............
Read answer

What are the Session State Modes? Define each Session State mode supported by ASP.NET.

ASP.NET supports three Session State modes. InProc, State Server, SQL
Server.................

ASP.NET Globalization and Localization


What is Globalization and Localization in ASP.NET?

Localization is the process of adapting a software application for a specific locale.


Globalization is the process of identifying the localizable resources of the
application.................
Read answer

What are the Globalization approaches possible in ASP.NET?

You can follow many approaches to have globalized application.


You can create separate web application for each culture.
You can create an application that can detect the user’s culture and adjusts .................
Read answer

Implementing ASP.NET Globalization.

Create resource files and compile them into a binary resource file.
Create satellite assembly for each of the resource file for each culture..............
Read answer

Define Resource Files and Satellite Assemblies.


Resource Files: A resource file contains non-executable data that are used by the
application and deployed along with it. Bitmaps, Icons etc are the examples of resource
files.................

Overview of the .NET Compact Framework

.NET Compact Framework is a scaled down versions of .NET framework for supporting Windows CE based
mobile and embedded devices like mobile phones...............
Read answer

Describes core components and capabilities of the .NET Compact Framework.

Some of the components and capabilities of .NET CF: Supports garbage collection..............
Read answer

Differences between the .NET Compact Framework and the full .NET Framework (desktop).

.NET CF is a subset (30%) of .NET Framework and also includes some specific class libraries for supporting
mobile devices. Here are the differences:..............
Read answer

Explain the devices and platforms supported by the .NET Compact Framework

.NET CF is supported by all Microsoft smart devices, including Pocket pc devices,................


Read answer

Describes how you can develop .NET Compact Framework applications with Visual Studio.

Visual studio has a template project for smart device. This enable developers to develop applications for
smart devices, embedded CE systems,, pocket pc etc.................
Read answer

NET Compact Framework Assemblies and Files

Assemblies and Files provided by .NET CF for application development:...............


Read answer

Describes the changes and improvements made to the .NET Compact Framework in version 3.5

Changes in .NET CF 3.5 are: Supports windows communication foundation (WCF). Supports language
integrated query (LINQ)..............
Read answer

Describes the configuration file settings supported in the .NET Compact Framework.

.NET CF 3.5supports configuration tool. This provides runtime version information and
administrative.............
Read answer

Describes how to install assemblies in the .NET Compact Framework global assembly cache.
Steps to install assemblies in .NET CF in GAC: Put assemblies in a directory on the device. Create a text file
which includes every file and it’s path on a separate line.................
Read answer

Differences between the DataGrid in the .NET Compact Framework and the DataGrid in the full .NET
Framework.

Datagrid in .NET CF provides the core functionality of the control in Windows Forms in complete .Net
framework. Datagrid is read only and does not support the following datagrid related types:..............
Read answer

Differences between Language-Integrated Query (LINQ) in the .NET Compact Framework and LINQ in
the full .NET Framework.

Differences between LINQ in .NET CF and LINQ in complete .Net Framework:.............


Read answer

List the limitations for using XML in the .NET Compact Framework.

Limitations of using XML in .Net CF: XmlDataDocument class is not supported.............


Read answer

Describes culture and globalization support provided by the .NET Compact Framework.

.NET CF provides limited support for globalization. Some of the limitations are: Cannot set current culture
programmatically..............
Read answer

Differences apply between generics in the .NET Compact Framework and in the full .NET
Framework.

Differences between generics in .NET CF and full .Net Framework: .NET CF does not support Expansive
generic recursion through fields...............

Explain Silverlight architecture.

Silver light is a plug-in used for different platforms and browsers. It is designed for offering media
experiences based on .net platform..................
Read answer

Difference between WPF and Silverlight

In terms of features and functionality, Silver light is a sub set of Windows Presentation Foundation...............
Read answer

What are the limitations of using external fonts in Silverlight?

One of the major challenges is to use a downloader and some of the SetFontSource methods on a
TextBlock to perform it................
Read answer

Describe how to perform Event handling in silver light


Event handling is performed in two event cases – Input events and Non-input events..................
Read answer

Explain how to add the reference of a Class library project in Silverlight application project

The following is the process for adding the reference library project: After defining business object classes in
another project –...............
Read answer

What is Silverlight.js file? Explain with an example.

Silverlight.js file is a Java Script helper file. It supports for adding a Silverlight application to a web page
through Java Script. It has a number of methods defined to help with, most importantly the
createObject......................
Read answer

What is a .xap file? Explain with an example.

A .xap file is an application package based on Silverlight which will be generated when the Silverlight project
is built. This file helpful in creating heavily client based Silverlight applications......................
Read answer

Explain how can Silverlight use ASX files.

An ASX file is an XML file in which media files are specified in the playlist. Using ASX files in silver is pretty
simple. Assign the ‘ source’ property of a MediaElement object to the ASX file name..............
Read answer

Explain Silverlight application life-cycle

The entry point of Silverlight applications is Silverlight Application class. It provides various services which is
commonly needed by Silverlight application....................
Read answer

What is the role of Silverlight Plugin in the Silverlight Application Life-Cycle?

The Silverlight plug-in loads the core services of Silverlight followed by Silverlight Common Language
Runtime. CLR creates domains for applications..................
Read answer

Explain the purpose of Storyboard.TargetProperty.

Using Storyboard.TargetProperty, the properties of an object can be assigned with values. The objects are
referred by Storyboard.TargetName attribute. The following snippet illustrates the change of width and color
of a rectangle object..................
Read answer

Why is XAP important?

Using XAP, Silverlight applications which are heavily client based can be created by managing code. The
managed code,.................
Read answer
How does XAP work?

The .xap file is used for transferring and containing the assemblies and resources of an application with
managed code. This code must be written within the Silverlight browser plugin.................
Read answer

Explain the use of ClientBin folder in Silverlight.

The ClientBin folder is used for placing .xap file of a Silverlight application. This folder can be kept anywhere
in the web application...................
Read answer

What is Clipping in Silverlight?

Clipping is a modification to a given image / object based on the geometry type – like a line, rectangle,
ellipse or even a group geometry objects...............
Read answer

What is the parent xaml tag of Silverlight page? Explain its purposes.

The’UserConrol’ is the parent xaml tag of a Silverlight page. All other tags are authored under UserControl
tag. Developers are given a facility to implement new custom controls and create re-usable user
controls...................
Read answer

Explain with example how to change the default page of the Silverlight application.

The RootVisual property of Application_Startup event in App.xaml file needs to be set to change the default
Silverlight application page. The following code snippet sets the property.................
Read answer

How many xaml files are created When you create a new project in Silverlight through Visual Studio
and what are the uses of those files?

There are two xaml files are created when a new project in Silverlight is created through Visual
Studio....................
Read answer

What are the programming language that can be used to write the backend of the Silverlight
application?

Visual Basic or Visual C# can be used for authoring code for the backend of the Silverlight
application....................
Read answer

Explain how to set Silverlight contents width as 100%.

Usually the UserConrol will be spread full screen. The contents width and height can also be set by using
width and height attributes...................
Read answer

Can you provide a list of Layout Management Panels and when you will use them?
The following are the list of Layout Management Panels: 1. Canvas Panel: Simple layouts use canvas panel
and when there is no requirement of resizing the panel. The controls will overlap each other at the time of
resizing the panel.................
Read answer

Explain how to apply style elements in a Silverlight project?

Application resources utilize the style elements for supporting the forms. The App.xaml file could be used to
contain an application resource XML construct. Each style’s target type is set to the control that needs the
style....................
Read answer

What are the main features and benefits of Silverlight?

The following are the features of SilverLight: 1. Built in CLR engine is available for delivering a super high
performance execution environment for the browser..................
Read answer

When would one use Silverlight instead of ASP.NET AJAX?

Silverlight media experiences and Rich Internet Applications can be enhanced by the existing ASP.NET
AJAX applications. Web applications and ASP.NET AJAX technologies are integrated in
Silverlight.......................
Read answer

When would a customer use Silverlight instead of Windows Presentation Foundation (WPF)?

Silverlight is used by customers for broader reach of interactive media content and browser-based rich
interactive, high performance applications..................
Read answer

Does Silverlight have a System.Console class? Why?

Yes. Silverlight have System.Console class. It is cocooned in the SecurityCritical attribute. It is so for using
for internal uses and making it useless for remote usage..................
Read answer

What are the properties that have to be initialized for creating a Silverlight control using
createSilverlight()?

The properties ‘source’ and ‘elementID’ are to be initialized. The ‘source’ attribute can be a ‘.xaml’ file or an
‘.aspx’ file.....................
Read answer

Explain the Path instructions in XAML

The <Path> instruction of XAML allows to draw and fill a path. Various points in the path represents are
represented by the Data attribute. The attribute includes M which means to move to command..................
Read answer

Explain the resemblance between CSS and Silverlight, regarding overlapping objects.
Silverlight content is hosted on the tag. CSS of DIV can be changed as it is for other HTML documents. The
changes can be for absolute positioning, z-indexing, top and left properties etc.....................
Read answer

What kind of Brushed does Silverlight support?

Silverlight brush objects supports for painting with solid colors, linear gradients, radical gradients and
images. SolidColorBrush is used to paint a closed object such as rectangle...................
Read answer

Explain the mouse events that Silverlight currently supports.

The mouse events that supports silverlight are - LostMouseCapture - occurs when an UI element lost mouse
capture...................
Read answer

Difference between MouseLeftButtonDown and MouseLeftButtonUp in Silverlight.

The difference is the action of the button. Once mouse button is pressed MouseLeftButtonDown event is
invoked......................
Read answer

What is the function used for removing an event listener?

The method removeEventListener() is used for deleting an event listener...................


Read answer

How would you implement Drag-and-drop in Silverlight?

Drag and drop in Silverlight can be implemented by using Drag Drop Manager by using DragSource and
DropTarget controls...................
Read answer

What are the properties of the eventArgs argument when capturing keyboard events?

The properties of eventArgs are types of keys like shift, ctrl and mouse actions, mouse pointer coordinates,
x coordinate value, y coordinate value..................
Read answer

What is the function used to get a reference to an object inside the Silverlight control?

The method findName() is used to refer an object inside the Silverlight control. The container reference is
made in the Container.xaml and the corresponding.....................
Read answer

What objects support tranformations? What are the transformations that Silverlight supports for the
elements?

The objects Ellipse and Rectangle are supported for transformations....................


Read answer

Explain the steps needed to be performed in order to create an animation in XAML


Animation is performed by using Storyboard.TargetName property. For example, to animate an object, the
following are the steps:..................
Read answer

What are the animation types supported by Silverlight?

Silverlight supports 2 types of animations:...................


Read answer

Explain the concept of KeyFrame. What is the difference between Silverlight and Flash regarding
animations?

The value of the target property is animated by a key-frame animation. A transition among its target values
over its duration is created. However the targeted values can by any number..................
Read answer

Explain how to control animation from JavaScript code.

The animation is controlled by starting the execution of Begin() on the Storyboard. For example let us name
the Storyboard as “animation”. The process of animation can be started by simply invoking the...................
Read answer

How could you determine the media position when playing a video in Silverlight?

The elements mePlayer.width and mePlayer.height retrieves the positions of the media in silver light. The
source of the media player is set by mePlayer.Source , using the uri resource.....................
Read answer

Explain the ways of accessing the Silverlight control from JavaScript?

The object tag is used to identify and store the silverlight controls....................
Read answer

What are the three units of information that the Silverlight plug-in exposes to JavaScript?

1. System.Browser name space and DOM...............


Read answer

How could you modify XAML content from JavaScript?

Place xaml in Java Script using createFromXaml function.................


Read answer

What are the necessary step that need to be performed in order to download content from within
Silverlight?

A collection independent files that contain XAML content, media assets, and other application information
can be downloaded from within Silverlight...................
Read answer

What ASP.NET control can embed XAML into ASP.NET pages?


The asp:Silverlight is used to embed XAML into ASP.Net pages.The following code snippet illustrates
this:....................
Read answer

Does Silverlight supports database connectivity? Explain

Silverlight supports database connectivity. It is done through LINQ to SQL classes...................


Read answer

What is the codec Silverlight supports for HD streaming?

The following formats are supported for Video streaming:


- WMV1: Windows Media Video 7
- WMV2: Windows Media Video 8..................
Read answer

How can IIS improve Silverlight Streaming?

IIS smooth streaming enables for delivering HD streams smoothly on any device. IIS smooth streaming is an
extension of IIS7 Media Services 3.0. It enables adaptive live streaming through HTTProtocols..................
Read answer

How to create hyperlinks in silverlight(in windows presentation foundation)?

Following is the process to create hyperlinks in Silverlight; - Select Canvas control in Toolbox in main XAML
document and draw a canvas object on the artboard.................
Read answer

What is SMPTE VC-1?

VC-1 is a video codec specification standardized by Society of Motion Picture and Television Engineers. It
was implemented by Windows Media Video 9.................
Read answer

What is XAML? Are XAML file compiled or built on runtime?

XAML stands for Extensible Application Markup Language. It is an XML based markup language. XAML is
the language for visual presentation of the application development in MS-Expression Blend.....................
Read answer

What are dependency properties in silverlight?

Dependency properties are exposed as CLR properties. Dependency properties’ purpose is to provide a
way of computing the value of a property that is based on the value of other inputs....................

ADO.NET overview

ADO.NET is design to provide data access. ADO.NET supports disconnected database access model which
means that connection is open long enough to perform data operation and is closed.............
Read answer
ADO.NET vs ADO

ADO.NET is considered as evolution version of ADO. ADO.NET works with both connected as well as
disconnected fashion whereas ADO works with connected architecture.............
Read answer

ADO.NET Data Architecture

ADO.NET has four layers. The Physical Data Store


This can be any database, XML files or OLE................
Read answer

Type of database connection in ADO.NET

SQL Connection
This object connects to the SQL Server..............
Read answer

Components of data providers in ADO.NET

The Connection Object


The Connection object represents the connection to the database. The Connection object has
ConnectionString property that contains all the information..............
Read answer

Define connected and disconnected data access in ADO.NET

You have connected data access through the DataReader objects of data provider. This object requires
exclusive use of the connection object. It can provide fast and forward-only data access. It doesn't allow
editing...................
Read answer

Describe CommandType property of a SQLCommand in ADO.NET.

A SQLCommand has CommandType property which can take Text, Storedprocedure or TableObject as
value. If it is set to Text, the command executes SQL string that is set to CommandText property................
Read answer

Define Dataview component of ADO.NET.

A DataView object allows you work with data of DataTable of DataSet object. It is associated with a
DataTable and sits on the top of DataTable..............
Read answer

What are the ways to create connection in ADO.NET?

There are two ways to create connection supported by ADO.NET.


Steps to create connection in code
Create instance of connection object..............
Read answer

Access database at runtime using ADO.NET


Steps to connect to database
Declare and initialize database connection object with appropriate connection string. Create a DataAdapter
and a Dataset object..............
Read answer

ADO.NET Code showing Dataset storing multiple tables

Declare and initialize database connection object with appropriate connection string. Create a DataAdapter
and a Dataset object............
Read answer

ADO.NET Code executing stored procedure

Code showing how to fetch data using Stored Procedure.

Imports System
Imports System.Data
Imports System.Data.SqlClient............
Read answer

ADO.NET transaction Processing

Steps to use transaction object


Open a database connection.
Create the transaction object using BeginTransaction method of connection object...............

Class is a group of items, attributes of some entity. Object is any specific item that may or may not be a part
of the class.............

Explain different properties of Object Oriented Systems.

An object oriented system revolves around a Class and objects. A class is used to describe characteristics
of any entity of the real world..............

What is difference between Association, Aggregation and Inheritance relationships?

An Association is a relationship between similar objects or objects with common structures. .............

Explain the features of an abstract class in NET.

An Abstract class is only used for inheritance. This means it acts as a base class for its derived
classes..............

Difference between abstract classes and interfaces

When a derived class is inherited from an Abstract class, no other class can be extended then. Interface can
be used in any scenario..............

Similarities and difference between Class and structure in .NET


Both Class and Structures can have methods, variables and objects..............

Features of Static/Shared classes.

Static classes are used when any change made to an object should not affect the data and functions of the
class..............

What is Operator Overloading in .NET?

Operator overloading is the most evident example of Polymorphism. In operator overloading, an operator is
‘overloaded’.............

What is Finalize method in .NET?

Object.Finalize method in .NET is typically used to clean and release unmanaged resources like OS files,
window etc..............

What are the concepts of DISPOSE method?

Dispose method belongs to IDisposable interface. It is used to free unmanaged resources like files, network
connection etc..............

ADO.NET Interview questions to be prepared before Interview.

1. Provide the namespaces for ADO.NET.


2. Brief about an overview of ADO.NET architecture.
3. List out difference between Dataset and ADO Recordset.
4. List out difference between classic ADO and ADO.NET.
5. Explain connection object in ADO.NET.
6. Explain the methods of command objects.
7. What is dataadapter? What are its methods?
8. What is Dataset object? What are the various objects in Dataset ?
9. How can we connect to Microsoft Access , Foxpro , Oracle etc ?
10. Explain how to check for changes made to dataset.
11. Provide namespace to connect to SQL Server.
12. Explain the steps to use stored proceduce in ADO.NET.
13. How can we force the connection object to close?
14. Is is possible to force datareader to return only schema.
15. How can we optimize command object when there is only one row?
16. What is basic use of “DataView” ?
17. Describe how to fill a dataset.
18. What are the methods provided by the dataset for XML?
19. Explain how to save all data from dataset.
20. How can we add/remove row’s in “DataTable” object of “DataSet” ?
21. What is difference between “DataSet” and “DataReader” ?
22. How can we load multiple tables in a DataSet ?
23. Explain how to add relation’s between table in a DataSet ?
24. What is the use of CommandBuilder?
25. List out difference between “Optimistic” and “Pessimistic” locking.
26. Describe the way to implement locking in ADO.NET.
27. Describe how to use transactions in .NET.
28. List out difference between dataset and datareader.
29. What’s difference between Dataset. clone and Dataset. copy ?
30. Which is the best place to store connectionstring?
31. What are .NET data providers?
32. DataReader vs. DataSet
33. What are the ADO.NET classes? Explain them
34. List the advantages of using ADO.NET over classic ADO.
35. Explain how to retrieve and update databases from ADO.NET.
36. How does XML integration go beyond the simple representation of data as XML?

Explain the .Net Framework.

The .Net framework allows infrastructural services to all the applications developed in .net compliant
language..................
Read answer

Describe the .Net Framework Architecture.

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.................
Read answer

What are the components of the .Net Framework.

Class Loader, Compiler, Garbage Collection, Type checker, Debug engine, Exception Manager.............
Read answer

Explain the role of assembly in the .Net Framework.

.Net Framework keeps executable code or DLL in the form of assembly. .Net Framework maintains multiple
versions of the application in the system through assembly..............
Read answer

Describe the GAC in the .Net Framework.

.Net Framework provides Global Assembly cache, a machine-wide cache...............


Read answer

What is the advantage of packaging over xcopy in .NET?

Define .Net Assembly.

It is a primary unit of deployment in a Microsoft .NET Framework application. It is called as building block of
an application which provides all required execution information to common language runtime.......................
Read answer

What does an assembly contain?


An assembly contains following information: Assembly manifest: Information about the
assembly...................
Read answer

Define a private assembly and a shared assembly.

A private assembly is stored in the application’s directory and used by a single application. A share
assembly can be used by multiple applications..................
Read answer

What are Satellite Assemblies?

Satellite assemblies provide an application the multilingual support. Satellite assemblies contain................
Read answer

What do you understand by side-by-site execution of assembly?

This means multiple version of same assembly to run on the same computer. This feature enables to deploy
multiple versions of the component.................
Read answer

How do you create a resource-only assembly?

Resources are nonexecutable data in an application and the data can be updated without recompiling
application. Resource assemblies can be created as follows:..................
Read answer

Explain how to retrieve resources using ResourceManager class.

ResourceManager class is used to retrieve resources at run time.


Create a ResourceManager with resource file name and the resource assembly as parameters..................
Read answer

Define Strong Name. How do you apply a strong name to assembly?

A strong name means generating public key in order to provide unique name to the assembly...................
Read answer

How do you install assembly to the Global Assembly Cache?

Followings are the steps to install assembly to the GAC.


Sign assembly with a strong name using strong name utility, sn.exe.................
Read answer

What is AL.EXE and RESGEN.EXE?

Resgen.exe performs conversion of .txt / .restext files to .resources / .resx files and vice-versa.....................

What is code security? What are the types?


.Framework provides the security features to secure code from unauthorized users and unauthorized
uses................
Read answer

Define Principal object.

The Principal object represents authenticated users. It contains information about user’s identity and
role...............
Read answer

Define declarative and imperative security.

Security checks can be applied imperatively or declaratively. Declarative security is applied by associating
attribute declarations...............
Read answer

Define role-based security.

Role-based security is to verify the role and/or identity of the current Principal object............
Read answer

Explain code access security.

Code access security protects code from unauthorized calls. You can prevent access to the system
resources using Permission object.............
Read answer

What is Code group?

Code groups represent collections of code and each code group has an associated set of
permissions............
Read answer

Define the use of Caspol.exe.

It is DOS command to view and alter code access security policy............

Define Data Access Modifier.

Access Modifiers or Access specifiers provide a class, a variable or a function with accessibility..............
Read answer

What are the access modifiers available?

There are five different access modifiers: public: It specifies that it can be accessed by anyone. private:
Private declared variables, classes or functions can be accessed only by the member functions. No one
from outside the class can access them...............
Read answer

What is the default access modifier for the member?

What are design patterns? Define basic classification of patterns.


A design pattern in Software is used to solve similar problems that occur in different scenarios.

What is the difference between Factory and Abstract Factory Patterns?

The difference between Factory and Abstract Factory Patterns lies in object instantiation. In Abstract factory
pattern Composition..........

What is MVC pattern?

Model View Controller is used to separate the interface from the business logic so as to give a better visual
appearance..............

How can we implement singleton pattern in .NET?

Singleton pattern restricts only one instance running for an object..........

How do you implement prototype pattern in .NET?

Prototype pattern is used to create copies of original instances known as clones. It is used when creating
instances of a class is very complex.......

What is aspect oriented programming? What is cross cutting in AOP?

When A computer program is broken into distinct features that overlap in functionality is called as Separation
of concerns. Aspect oriented programming (AOP) aims to improve the.........

What is Windows DNA architecture?

Windows Distributed internet Applications architecture provides a robust, efficient solution to enable
Windows platform.........

What is Service Oriented architecture?

Service oriented architecture is based on services. Service is a unit of some task performed by a service
provider in order to satisfy the consumer.............

What is three tier architecture?

Three tier architecture typically consists of a client, server and “agent” between them. The agent is
responsible for gathering the results and returning..............

Explain the situations you will use a Web Service and Remoting in projects.

Web services should be used if the application demands communication over a public network and require
to work across multiple platforms......................

The .NET Framework class library is a library of classes, interfaces, and value types...............
Read answer

What is the difference between value types and reference types?


-Value types are inherited from system.valuetypes
-Reference types are inherited system.object..............

Explain CLR in brief.

CLR stands for Common Language Runtime. The CLR is a development platform. It provides a runtime,
defines functionality in some libraries,.............
Read answer

Describe how a .Net application is compiled and executed.

From the source code, the compiler generates Microsoft Intermediate Language (MSIL) which is further
used for the creation of an EXE or DLL...................
Read answer

Describe the parts of assembly.

An assembly is a partially compiled code library. In .NET, an assembly is a portable executable and can be
an EXE (process assembly) or a DLL (library assembly)..............
Read answer

Overview of CLR integration.

The CLR (Common Language Runtime) integration is hosted in the Microsoft SQL Server 2005...............

Describe how to create and use array in .NET.

Arrays treat several items as a single collection...............


Read answer

Define Constants and Enumerations in .NET.

Constants are values which are known at compile time and do not change...........
Read answer

Explain collection in .NET and describe how to enumerate through the members of a collection.

There are various collection types in .NET which are used for manipulation of data. Collections are available
in System.Collections namespace...............
Read answer

Summarize the similarities and differences between arrays and collections.

The Array class is not part of the System.Collections namespaces Collections are. But an array is a
collection, as it is based on the IList interface...............
Read answer

Briefly describe the two kinds of multidimensional arrays in .NET.

There are two types of multidimensional arrays: Rectangular arrays : These multidimensional arrays have all
the sub-arrays with a particular dimension of the same length. You need use a single set of square brackets
for rectangular arrays..............
Describe how to create and use array in .NET.

Arrays treat several items as a single collection.

Following are the ways to create arrays:

Declaring a reference to an array


Int32[] a;

Create array of ten Int32elements


b = new Int32[10];

Creating a 2-dimensional array


Double[,] c = new Double[10, 20];

Creating a 3-dimensional array


String[,,] d = new String[5, 3, 10];

Describe how to create and use array in .NET.

Arrays treat several items as a single collection...............


Read answer

Define Constants and Enumerations in .NET.

Constants are values which are known at compile time and do not change...........
Read answer

Explain collection in .NET and describe how to enumerate through the members of a collection.

There are various collection types in .NET which are used for manipulation of data. Collections are available
in System.Collections namespace...............
Read answer

Summarize the similarities and differences between arrays and collections.

The Array class is not part of the System.Collections namespaces Collections are. But an array is a
collection, as it is based on the IList interface...............
Read answer

Briefly describe the two kinds of multidimensional arrays in .NET.

There are two types of multidimensional arrays: Rectangular arrays : These multidimensional arrays have all
the sub-arrays with a particular dimension of the same length. You need use a single set of square brackets
for rectangular arrays..............
Read answer

Define context menu.

The menu that you get when you right-click is called the context ment. It is a modular piece of markup code
that can move around the page..............
Read answer
What is the purpose of CloneMenu?

CloneMenu method copies the whole list of MenuItem objects into the current menu. It accepts a parameter
of the type Menu................
Read answer

Explain how to dynamically add items to a menu in .NET.

Following answer provides a very generalized idea of how this can be done: The first step would be locating
the Assembly DLL..............
Read answer

Explain how to dynamically clone a menu in .NET.

Follow the steps below to dynamically clone a menu in .NET: Create an alternate MainMenu object...............
Read answer

What is garbage collection?

The applications created acquire memory. Memory management includes deallocating this acquired
resources and acquiring them.............

Is it possible to force garbage collection to run?

Yes, it is possible to force Garbage Colletcion . The way to do it is by using GC.Collect()....................

Define Dispose().

It is a method for releasing resources that an object acquires.............

Explain how garbage collection manages reclamation of unused memory in .NET.

CLR performs garbage collection on small objects and large objects separately. It maintains separate heaps
for these two types of objects..............

Explain how garbage collection deals with circular references.

Circular referencing issue happens when two objects refer to each other. Usually in a parent-child
relationship, situations occur where a child interacts with the parent object and has a reference held to the
parent object...................

What is break mode? What are the options to step through code?

Break mode lets you to observe code line to line in order to locate error.
VS.NET provides following option to step through code............

Debug Vs Trace.

Both these objects are found in the System.Diagnostics namespace.


Both are used for diagnose problems...............

Define trace class.


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................

Define Listeners collection of Trace and Debug objects.

The Trace and Debug objects contain a Listeners collection.


These Listeners collection collect output from the trace statements.
There are three types of predefined listeners:...............

Define Trace Switches.

Trace switches are used to configure tracing behavior.


There are two kinds of trace switches: BooleanSwitch and TraceSwitch.
BooleanSwitch: It is either on or off..............

What is Manifest in .NET?

Manifest in .NET helps to understand the relation between the elements of the assemblies...........

What is GAC in .NET?

When an application is shared amongst several other applications, the complete machine code is present
the Global assembly cache............

Explain Boxing and Unboxing in .NET.

Boxing permits any value type to be implicitly converted to type object or to any interface type Implemented
by value type.............

Who Benefits from AJAX?

AJAX is employed to improve the user’s experience. A request is made for the initial page rendering. After
that, asynchronous requests to the server are made. An asynchronous request is a background request to
send or receive data in an entirely nonvisual manner.............

Explain the features of an abstract class in NET.

An Abstract class is only used for inheritance. This means it acts as a base class for its derived
classes..............

Difference between abstract classes and interfaces

When a derived class is inherited from an Abstract class, no other class can be extended then. Interface can
be used in any scenario..............

Explain how to implement properties.

You can either use fields or property procedure to add properties. It is convenient to use fields when the
values associated with the properties are less in number. eg: boolean which can have only two values
associated with it..................
Explain how to create a read-only or write-only property.

You can either use fields or property procedure to add properties.To create a property that can only be read
and not altered, you need to decalre it as ReadOnly. After doing this, if you try to assign value to the
property, an error will occur...............

Describe .NET form.

Forms provide a User Interface (UI) to give the applications a look and feel. Forms provide properties,
methods, and events for the controls they contain. In Microsoft Visual Studio .NET, there is drag-and-drop
facility for creating Web applications...............

What are Form properties?

The common properties that all of the controls on form have are:...............

What are Form methods that control its lifecycle?

First a form object is created using the constructor. The form is then loaded and then its layout is initialized.
After that it gets activated after which the paint is called

Define Assembly.

An Assembly is a collection, either an executable (.exe) or a dynamic link library (.dll), that forms a logical
unit of functionality and built to efficiently work together.............

What is manifest?

An Assembly data like version, scope, security information (strong name),etc is stored in manifest...............

Explain GAC.

GAC stands for global assembly cache. It is an area of memory reserved to store the assemblies of all .NET
applications that are running on a certain machine..............

What is the use of SN.EXE?

SN stands for Strong Name.


Strong Name Tool (Sn.exe) is used to sign assemblies with strong names...........

What is a Satellite assembly?

A satellite assembly contains resources specific to a given language............

Explain the different types of assemblies in .NET, i.e. Static and dynamic assemblies, Private and
Shared assemblies, Single-file and Multiple-file assemblies.

Static assemblies contain interfaces, classes, resources, etc for the assembly and are stored on disk in
portable executable (PE) files................
What is user-defined data type?

A user-defined type is a named data type created by the user. It can be a distinct type sharing a common
representation with some built-in data type.................

Classes vs. Structures

The class is an extension of a structure. Structure members have public access by default
Class member variables are private by default.............

What is the role of data provider?

The .NET data provider layer resides between the application and the database. Its task is to take care of all
their interactions................

Explain how to filter and sort data with the DataView component.

One of the ways to sort and filter data is to use the ‘select’ method. However, our focus is on the DataView
object..............

What is DataViewManager?

DataViewManager can be used to manage view settings of the tables in a DataSet. A DataViewManager is
best suited for views...............

Describe the basic schema of a .config file.

Configuration File Schema for the .NET Framework. Configuration Files are standard XML files. The
elements that implement configuration settings are:.............

How to use performance monitor to diagnose bottlenecks in your application?

Monitor is a tool built to assist you in diagnosing the problem.


Type ‘perfmon’ in command prompt to access Performance Monitor............

Explain the different types of configuration files provided by .NET framework? - Machine
configuration file, Application configuration file, Security configuration file.

The different types of configuration files provided by .NET framework are:..............

What is AppSetting section in Web.Config file?

The <appSettings> element of a web.config file where connection strings, server names, file paths, and
other miscellaneous settings are stored.................
ASP.NET 2.0 Features
Developer Productivity
Master Pages
New Code-Behind Model in ASP.NET 2.0
Creating & Sharing Reusable Components
New ASP.NET 2.0 Controls
Data Controls
Security Controls
Other New Controls
Validation Groups
Themes
Web Parts Framework
Visual Studio 2005 Improvements
Administration and Management
Speed and Performance
Caching Feature

Model View Controller

These days, Model View Controller (MVC) is a buzzword in the ASP.NET community, thanks to the
upcoming ASP.NET MVC framework that Microsoft is expected to launch soon (at the time of writing of this
book, only Preview 5 was available). This chapter is dedicated to MVC design and the ASP.NET MVC
framework.

In this chapter, 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. The
following are some highlights of this chapter:

 Understanding the Page Controller pattern


 Understanding the need for the MVC design pattern
 Learning the basics of MVC design
 Understanding the Front Controller design pattern
 Understanding REST architecture
 Understanding the ASP.NET MVC framework
 Implementing the ASP.NET MVC framework in a sample application

Explain constructor and destructor with an example using C#.NET.

A constructor is a member function that performs the task of initializing the objects with the default values to
be assigned after creation.

A destructor is a function that is run to release the resources held by an object when it is no longer needed
by the application.

In C#.NET we can create constructor and destructor in the following manner:

-----------------CONSTRUCTOR---------

class C
{
private int x;
private int y;
public C (int i, int j)
{
x = i;
y = j;
}
public void display ()
{
Console.WriteLine(x + "i+" + y);
}
}

-----------------DESTRUCTOR---------

class D
{
public D()
{
// constructor
}
~D()
{
// Destructor
}
}

Define base class control.

Answer
The Control class is the base class for many of the controls that are added to an application. The Control
class defines very little behavior but it is far more common to add a control that inherits from Control like
Button, etc.

What is inherited control?

Answer
A new control can be created by inheriting from an existing control. This way, the new control contains all
the functionality of the base control and can serve its own functionality as well. This is also in regards to the
visual appearance of the base control.

Define UserControl class.

Answer
User Controls are created by the user and are based on the class UserControl
(System.Windows.Forms.UserControl). User controls too have properties, methods and events.

What is Dataset object?

Databases
|
DataProviders
|
DataAdapters
|
DataSets.....................

What are the various objects in Dataset?


The DataSet class exists in the System.Data namespace. The Classes contained in the DataSet class
are:..............

How to save data from dataset?

The modified data needs to be sent back to the database in order to save it. Therefore, to send the modified
data to a database...............

Explain the difference between dataset clone and dataset copy?

Dataset.clone() duplicates (only) the structure of a dataset, without duplicating the data...............

Explain the difference between DataSet and DataReader

Datareader fetches one row at a time from the datasource. DataSet fetches all data from the datasource at a
time to its memory area..............

How do we step through code?

Stepping through the code is a way of debugging the code in which one line is executed at a time. There are
three commands for stepping through code:..............

What are the debugging windows available?

The windows which are available while debugging are:..............

What is Break mode?

When changes are made to the code in an application, the way to be able to view how those changes have
changed the way of execution is Break Mode.............

What are the options for stepping through code?

The applications consist of various activities which need to be performed during the execution................

What is a Breakpoint?

Using Breakpoints you can break or pause the execution of an application at a certain point................

Define Debug and Trace Class.

Debug Class (System.Diagnostics)


It provides a set of methods and properties that help debug your code. This class cannot be
inherited.................

What are Trace switches?

Trace switches are used to enable, disable and filter the tracing output................

Explain how to configure Trace switches in the application's .config file.


Switches are configured using the .config file.
Trace switches can be configured in an application and the trace output can be enabled or disabled..............

What is an Event?

When an action is performed, this action is noticed by the computer application based on which the output is
displayed...............

Define Delegate.

Delegates are kind of similar to the function pointers. But they are secure and type-safe...................

What is the purpose of AddHandler keyword?

The AddHandler statement allows you to specify an event handler. AddHandler has to be used to handle
shared events or events from a structure.

Describe how exceptions are handled by the CLR?

Usually the exceptions that occur in the try are caught in the catch block. The finally is used to do all the
cleaning up work. But exceptions can occur even in the finally block.................

How to throw a custom exception?

The usual try - catch - finally - ent try format has to be followed. However, in this case, instead of using the
preset exceptions from the System.Exception..............

What is XCopy?

XCopy command is an advanced version of the copy command used to copy or move the files or
directories..............

What is the purpose of a bootstrapper application?

A bootstrapper eases the installation of the various required components for an application. It provides a
simple.................

What are the deployment features of the .NET Framework?

The following features make the deployment of the application of the .NET framework easier:..................

What are Merge module projects?

Merge module projects are used for the packaging of files or components that are shared between multiple
applications..................

Explain what a permissiong is.

Permissioning is tha ability the CLR possesses to allow or deny a certain program to access a resource. The
.net set of permissions is included in the..............
What are the differences between declarative and imperative security.

Declarative and imperative are the different syntax schemes used to implement security declarations in
.NET Framework.................

Explain role-based and code based security.

Based on the credentials of the user, the access is provided to the user..............

Define XSLT.

XSLT language is used for transforming XML documents into XHTML documents...............

What is XPATH?

XPath is a language that is used to navigate through XML documents.............

Define XMLReader Class.

The XMLReader Class (Assembly: System.Xml.dll) represents a reader.............

Define XMLValidatingReader class.

The XMLValidatingReader class (Assembly: System.Xml.dll) represents a reader that provides:............

Explain Form level validation and Field level Validation.

Field-level validation provides immediate validation of the input given by the user. The events associated
with field-level validation are KeyDown, KeyPress, textchange, etc.

In form-level validation the validation step is done after the filling up of the form is done. It’s usually when the
user submits the forms.

What is Windows Communication Foundation, WCF?

WCF helps in building applications to communicate with each other. It is a framework that helps in managing
distributed computing...............

What are the components of WCF?

Components of WCF Contracts and descriptions: - Describes different features of messaging. The features
are described by Data contract, message contract, service contract and policy and binding..................

What is the difference between WCF and Web services?

WCF has a variety of distributed programming infrastructures. WCF offers more flexibility and
portability................

What is duplex contracts in WCF?

WCF allows duplex messaging pattern. Services can communicate with client through a callback. Duplex
messaging in WCF................
What are different binding supported by WCF?

Different bindings
Built- in bindings and custom bindings. When the built in or system provided bindings are not suited for the
requirement...............

How do we use MSMQ binding in WCF?

Message queue allows applications running at different times to send and read messages from queues.
WCF uses transactional queue to capture messages, delivered and stored...................

Explain volatile queues and Dead letter queues.

WCF also uses non transactional queues for storing messages. Such queues are volatile in nature. They are
stored in memory and not used in transactions. On shutting down the machine, the queue is lost.................

What are the various ways of hosting a WCF service?

Ways of hosting WCF Service: Self hosting: - The service code is embedded within the application code. An
end point for the service is defined and an instance of SeriveHost is created......................

Explain transactions in WCF.

Transactions in WCF allow several components to concurrently participate in an operation.................

What are the various programming approaches for WCF?

Programming approaches for WCF: Imperative: - Different programming languages can be sued for
implementing service logic..................

What are the advantages of hosting WCF services in IIS?

Advantages of hosting WCF services in IIS : Provides process activation and recycling ability thereby
increasing reliability..............

What are different isolation levels provided in WCF?

The different isolation levels: READ UNCOMMITTED: - An uncommitted transaction can be read. This
transaction can be rolled back later..................

What is Windows Presentation Foundation, WPF?

WPF allows creating rich application with respect to look and feel. The rich classes of WPF................

What are the different documents supported in WPF?

The different documents supported by WPF are mainly fixed documents and flow documents. Fixed
documents are used for what you see is what you get (WYSIWYG) applications.................

What is XAML?
Extensible Application Markup Language is a XML based language used to create rich GUI’s. It supports
both vector and bitmap images....................

What is Windows Workflow Foundation?

WWF is a programming model used for building workflow enabled applications. It helps to define, execute
and manage workflows...............

What are different types of Workflow in Windows Workflow Foundation?

Types of Workflows in WCF:- Sequential workflow: - Follows a sequence like a flowchart, progressing from
one stage to another without turning back...........

What is the purpose of XOML file?

XOML file is Extensible Object Markup Language. It is used for workflow files as an extension.....................

How do we access crystal reports in .NET?

When crystal reports are integrated with .NET, data can be accessed using ODBC drivers, ADO drivers,
database files like excel, xml etc..................
Read answer

What are the various components in crystal reports?

When .NET application uses crystal reports, the following components are required: Report files: .rpt or
report files needs to be distributed which can either be compiled into the application (Embedded) or
independently (non embedded) from the application.............
Read answer

What basic steps are needed to display a simple report in crystal?

Crystal reports offer a report designer. First, select specific rows and columns from a table. Using the
designer, the data on the report can be rearranged and formatted.................

What is a CLR (Common Language Runtime)?

Common Language Runtime is a run time environment for .NET..........

Explain the concepts of CTS and CLS(Common Language Specification).

CTS define how these different variables are declared and used in run time...........

Explain the concepts and capabilities of Assembly in .NET

An assembly is a collection of files (dll’s, exe’s), group of resources that help in creating a logical unit of
functionality...........

What is Manifest in .NET?

Manifest in .NET helps to understand the relation between the elements of the assemblies...........
What is GAC in .NET?

When an application is shared amongst several other applications, the complete machine code is present
the Global assembly cache............

What is garbage collection? How to force garbage collector to run?

Garbage collection helps in releasing memory occupied by objects. CLR automatically releases these
unused objects...........

Explain the different types of JIT in MS .NET.

JIT compiler is a part of the runtime execution environment that helps in a higher performance by placing the
complied code in the cache for a faster execution.............

Explain Boxing and Unboxing in .NET.

Boxing permits any value type to be implicitly converted to type object or to any interface type Implemented
by value type.............

Difference between System exceptions and Application exceptions.

Application exceptions can be user defined exceptions thrown by the application.............

What is Native Image Generator (Ngen.exe)?

Ngen.exe helps in improving performance of managed applications by creating native images and storing
them on the cache.............

Potrebbero piacerti anche