What is ASP.NET?
Microsoft ASP.NET is a server side technology that enables programmers to build
dynamic Web sites, web applications, and XML Web services. It is a part of the .NET
based environment and is built on the Common Language Runtime (CLR) . So
programmers can write ASP.NET code using any .NET compatible language.
What are the differences between ASP.NET 1.1 and ASP.NET 2.0?
A comparison chart containing the differences between ASP.NET 1.1 and ASP.NET 2.0
can be found over here.
Which is the latest version of ASP.NET? What were the previous versions
released?
The latest version of ASP.NET is 2.0. There have been 3 versions of ASP.NET released as
of date. They are as follows :
PreInit – This event represents the entry point of the page life cycle. If you need to
change the Master page or theme programmatically, then this would be the event to do
so. Dynamic controls are created in this event.
PreLoad* - This event is called before the loading of the page is completed.
Load – This event is raised for the Page and then all child controls. The controls
properties and view state can be accessed at this stage. This event indicates that the
controls have been fully loaded.
LoadComplete* - This event signals indicates that the page has been loaded in the
memory. It also marks the beginning of the rendering stage.
PreRender – If you need to make any final updates to the contents of the controls or
the page, then use this event. It first fires for the page and then for all the controls.
Unload – This event is typically used for closing files and database connections. At
times, it is also used for logging some wrap-up tasks.
The events marked with * have been introduced in ASP.NET 2.0.
You have created an ASP.NET Application. How will you run it?
With ASP.NET 2.0, Visual Studio comes with an inbuilt ASP.NET Development Server to
test your pages. It functions as a local Web server. The only limitation is that remote
machines cannot access pages running on this local server. The second option is to
deploy a Web application to a computer running IIS version 5 or 6 or 7.
Which are the new special folders that are introduced in ASP.NET 2.0?
There are seven new folders introduced in ASP.NET 2.0 :
\App_Code folder – Contains source code (.cs, .vb) files which are automatically
compiled when placed in this folder. Additionally placing web service files generates a
proxy class(out of .wsdl) and a typed dataset (out of .xsd).
\App_Data folder – Contains data store files like .mdf (Sql Express files), .mdb, XML
files etc. This folder also stores the local db to maintain membership and role
information.
\App_Themes folder – This folder contains .css and .skin files that define the
appearance of web pages and controls.
You can disable viewstate by a control by setting the EnableViewState property to false.
What does the EnableViewState property signify?
EnableViewState saves the state of an object in a page between postbacks. Objects are
saved in a Base64 encoded string. If you do not need to store the page, turn it off as it
adds to the page size.
@ Control - Defines control-specific attributes used by the ASP.NET page parser and
compiler and can be included only in .ascx files (user controls).
@ Master - Identifies a page as a master page and defines attributes used by the
ASP.NET page parser and compiler and can be included only in .master files.
@ MasterType - Defines the class or virtual path used to type the Master property of a
page.
@ Page - Defines page-specific attributes used by the ASP.NET page parser and
compiler and can be included only in .aspx files.
@ PreviousPageType - Creates a strongly typed reference to the source page from the
target of a cross-page posting.
@ Reference - Links a page, user control, or COM control to the current page or user
control declaratively.
@ Register - Associates aliases with namespaces and classes, which allow user controls
and custom server controls to be rendered when included in a requested page or user
control.
RequiredFieldValidator – Checks if the control is not empty when the form is submitted.
RangeValidator – Checks whether a value falls within a given range of number, date or
string.
How do you set the title of an ASP.NET page that is attached to a Master Page?
By using the Title property of the @Page directive in the content page. Eg:
Defines a skin that will be applied to all buttons throughout to give it a consistent look
and feel.
User controls have limited support for consumers who use a visual design tool whereas
custom controls have full visual design tool support for consumers.
A separate copy of the user control is required in each application that uses it whereas
only a single copy of the custom control is required, in the global assembly cache, which
makes maintenance easier.
A user control cannot be added to the Toolbox in Visual Studio whereas custom controls
can be added to the Toolbox in Visual Studio.
User controls are good for static layout whereas custom controls are good for dynamic
layout.
Web.config files are located in the application's root directory or inside a folder situated
in a lower hierarchy. The machine.config is located in the Windows directory
Microsoft.Net\Framework\Version\CONFIG.
Response.Redirect can be used for both .aspx and html pages whereas Server.Transfer
can be used only for .aspx pages.
Response.Redirect changes the url in the browser. So they can be bookmarked. Whereas
Server.Transfer retains the original url in the browser. It just replaces the contents of
the previous page with the new one.
Web Services are applications delivered as a service on the Web. Web services allow for
programmatic access of business logic over the Web. Web services typically rely on XML-
based protocols, messages, and interface descriptions for communication and access.
Web services are designed to be used by other programs or applications rather than
directly by end user. Programs invoking a Web service are called clients. SOAP over
HTTP is the most commonly used protocol for invoking Web services.