1. What is ASP.Net?
It is a framework developed by Microsoft on which we can develop new generation web sites using web forms(aspx), MVC, HTML, Javascript, CSS etc. Its successor of Microsoft Active Server Pages(ASP). Currently there is ASP.NET 4.0, which is used to develop web sites. There are various page extensions provided by Microsoft that are being used for web site development. Eg: aspx, asmx, ascx, ashx, cs, vb, html, xml etc.
2. What’s the use of Response.Output.Write()?
We can write formatted output using Response.Output.Write().
3. In which event of page cycle is the ViewState
available?
After the Init() and before the Page_Load().
4. What is the difference between Server.Transfer and Response.Redirect? In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. The clients url history list or current url Server does not update in case of Server.Transfer.Response.Redirect is used to redirect the user’s browser to another page or site. It performs trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.
5. From which base class all Web Forms are inherited?
Page class.
6. What are the different validators in ASP.NET?
Required field Validator
Range Validator
Compare Validator
Custom Validator
Regular expression Validator
Summary Validator
7. Which validator control you use if you need to make sure the values in two different controls matched?
Compare Validator control.
8. What is ViewState?
ViewState is used to retain the state of server-side objects between page post backs.
9. Where the viewstate is stored after the page postback?
ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.
10. How long the items in ViewState exists?
They exist for the life of the current page.
11. What are the different Session state management options available in ASP.NET?
In-Process
Out-of-Process.
In-Process stores the session in memory on the web server.
Out-of-Process Session state management stores data in an external server. The external server may be either a SQL Server or a State Server. All objects stored in session are required to be serializable for Out-of-Process state management.
12. How you can add an event handler?
Using the Attributes property of server side control.
e.g.
?
12 |
btnSubmit.Attributes.Add("onMouseOver","JavascriptCode();") |
13. What is caching?
Caching is a technique used to increase performance by keeping frequently accessed data or files in memory. The request for a cached file/data will be accessed from cache instead of actual location of that file.
14. What are the different types of caching?
ASP.NET has 3 kinds of caching :
Output Caching,
Fragment Caching,
Data Caching.
15. Which type if caching will be used if we want to cache the portion of a page instead of whole page?
Fragment Caching: It caches the portion of the page generated by the request. For that, we can create user controls with the below code:
?
12 |
<%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%> |
16. List the events in page life cycle.
1) Page_PreInit
2) Page_Init
3) Page_InitComplete
4) Page_PreLoad
5) Page_Load
6) Page_LoadComplete
7) Page_PreRender
8)Render
17. Can we have a web application running without web.Config file?
Yes
18. Is it possible to create web application with both webforms and mvc?
Yes. We have to include below mvc assembly references in the web forms application to create hybrid application.
?
123456 |
System.Web.MvcSystem.Web.RazorSystem.ComponentModel.DataAnnotations |
19. Can we add code files of different languages in App_Code folder?
No. The code files must be in same language to be kept in App_code folder.
20. What is Protected Configuration?
It is a feature used to secure connection string information.
21. Write code to send e-mail from an ASP.NET application?
?
1234567 |
MailMessage mailMess = new MailMessage ();mailMess.From = "abc@gmail.com";mailMess.To = "xyz@gmail.com";mailMess.Subject = "Test email";mailMess.Body = "Hi This is a test mail.";SmtpMail.SmtpServer = "localhost";SmtpMail.Send (mailMess); |
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
22. How can we prevent browser from caching an ASPX page?
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s Cache property:
?
123 |
Response.Cache.SetNoStore ();Response.Write (DateTime.Now.ToLongTimeString ()); |
23. What is the good practice to implement
validations in aspx page?
Client-side validation is the best way to validate data of a web page. It
reduces the network traffic and saves server resources.
24. What are the event handlers that we can have
in Global.asax file?
Application Events: Application_Start , Application_End, Application_AcquireRequestState,
Application_AuthenticateRequest, Application_AuthorizeRequest,
Application_BeginRequest, Application_Disposed, Application_EndRequest,
Application_Error, Application_PostRequestHandlerExecute,
Application_PreRequestHandlerExecute,
Application_PreSendRequestContent, Application_PreSendRequestHeaders,
Application_ReleaseRequestState, Application_ResolveRequestCache,
Application_UpdateRequestCache session Events session _start,Session_end.
25. Which protocol is used to call a Web service?
HTTP Protocol
26. Can we have multiple web config files for an
asp.net application?
Yes.
27. What is the difference between web config and
machine config?
Web config file is specific to a web application where as machine config is
specific to a machine or server. There can be multiple web config files into an
application where as we can have only one machine config file on a server.
28. Explain role based security ?
Role Based Security used to implement security based on roles assigned to user groups in the organization.
Then we can allow or deny users based on their role in the organization. Windows defines several built-in groups, including Administrators, Users, and Guests.
?
12345 |
<AUTHORIZATION>< authorization >< allow roles="Domain_Name\Administrators" / > < !-- Allow Administrators in domain. -- >< deny users="*" / > < !-- Deny anyone else. -- >< /authorization > |
29. What is Cross Page Posting?
When we click submit button on a web page, the page post the data to the same page. The technique in which we post the data to different pages is called Cross Page posting. This can be achieved by setting POSTBACKURL property of the button that causes the postback. Findcontrol method of PreviousPage can be used to get the posted values on the page to which the page has been posted.
30. How can we apply Themes to an asp.net application?
We can specify the theme in web.config file. Below is the code example to apply theme:
?
12345678910 |
<configuration><system.web><pages theme="Windows7" /></system.web></configuration> |
31: What is RedirectPermanent in ASP.Net?
RedirectPermanent Performs a permanent redirection from the requested URL to the specified URL. Once the redirection is done, it also returns 301 Moved Permanently responses.
32: What is MVC?
MVC is a framework used to create web applications. The web application base builds on Model-View-Controller pattern which separates the application logic from UI, and the input and events from the user will be controlled by the Controller.
33. Explain the working of passport authentication.
First of all it checks passport authentication cookie. If the cookie is not available then the application redirects the user to Passport Sign on page. Passport service authenticates the user details on sign on page and if valid then stores the authenticated cookie on client machine and then redirect the user to requested page
34. What are the advantages of Passport authentication?
All the websites can be accessed using single login credentials. So no need to remember login credentials for each web site.
Users can maintain his/ her information in a single location.
35. What are the asp.net Security Controls?
<asp:Login>: Provides a standard login capability that allows the users to enter their credentials
<asp:LoginName>: Allows you to display the name of the logged-in user
<asp:LoginStatus>: Displays whether the user is authenticated or not
<asp:LoginView>: Provides various login views depending on the selected template
<asp:PasswordRecovery>: email the users their lost password
36: How do you register JavaScript for webcontrols
?
We can register javascript for controls using <CONTROL
-name>Attribtues.Add(scriptname,scripttext) method.
37. In which event are the controls fully loaded?
Page load event.
38: what is boxing and unboxing?
Boxing is assigning a value type to reference type variable.
Unboxing is reverse of boxing ie. Assigning reference type variable to value type variable.
39. Differentiate strong typing and weak typing
In strong typing, the data types of variable are checked at compile time. On the other hand, in case of weak typing the variable data types are checked at runtime. In case of strong typing, there is no chance of compilation error. Scripts use weak typing and hence issues arises at runtime.
40. How we can force all the validation controls to run?
The Page.Validate() method is used to force all the validation controls to run and to perform validation.
41. List all templates of the Repeater control.
ItemTemplate
AlternatingltemTemplate
SeparatorTemplate
HeaderTemplate
FooterTemplate
42. List the major built-in objects in ASP.NET?
Application
Request
Response
Server
Session
Context
Trace
43. What is the appSettings Section in the web.config file?
The appSettings block in web config file sets the user-defined values for the whole application.
For example, in the following code snippet, the specified ConnectionString section is used throughout the project for database connection:?
|
<em><configuration><appSettings><add key="ConnectionString" value="server=local; pwd=password; database=default" /></appSettings></em> |
44. Which data type does the RangeValidator control support?
The data types supported by the RangeValidator control are Integer, Double, String, Currency, and Date.
45. What is the difference between an HtmlInputCheckBox control and an HtmlInputRadioButton control?
In HtmlInputCheckBoxcontrol, multiple item selection is possible whereas in HtmlInputRadioButton controls, we can select only single item from the group of items.
46. Which namespaces are necessary to create a localized application?
System.Globalization
System.Resources
47. What are the different types of cookies in ASP.NET?
Session Cookie – Resides on the client machine for a single session until the user does not log out.
Persistent Cookie – Resides on a user’s machine for a period specified for its expiry, such as 10 days, one month, and never.
48. What is the file extension of web service?
Web services have file extension .asmx..
49. What are the components of ADO.NET?
The components of ADO.Net are Dataset, Data Reader, Data Adaptor, Command, connection.
50. What is the difference between ExecuteScalar and ExecuteNonQuery?
ExecuteScalar returns output value where as ExecuteNonQuery does not return any value. ExecuteScalar used for fetching a single value and ExecuteNonQuery used to execute Insert and Update statements.
51.What is new with ASP.Net 4 WebForms ?
Ans. Some of the Features are:
. Ability to Set Metatags.
. More control over view state.
. Added and Updated browser definition files.
. ASP.Net Routing.
. The ability to Persist Selected rows in data Control.
. More control over rendered HTML in FormView and ListView Controls.
. Filtering Support for datasource Controls.
Q. What is
machine.config file and how do you use it in ASP.Net 4.0?
Ans. Machine.Config file is found in the "CONFIG" subfolder of your
.NET Framework install directory (c:\WINNT\Microsoft.NET\Framework\{Version
Number}\CONFIG on Windows 2000 installations). It contains configuration settings
for machine-wide assembly binding, built-in remoting channels, and ASP.NET.
In .the NET Framework 4.0, the major configuration elements(that use to be in
web.config) have been moved to the machine.config file, and the applications
now inherit these settings. This allows the Web.config file in ASP.NET 4
applications either to be empty or to contain just the following lines.
Q. What is
RedirectPermanent in ASP.Net 4.0?
Ans. In earlier Versions of .Net, Response.Redirect was used, which issues an
HTTP 302 Found or temporary redirect response to the browser (meaning that
asked resource is temporarily moved to other location) which inturn results in
an extra HTTP round trip. ASP.NET 4.0 however, adds a new RedirectPermanent
that Performs a permanent redirection from the requested URL to the specified
URL. and returns 301 Moved Permanently responses.
e.g. RedirectPermanent("/newpath/foroldcontent.aspx");
Q. How will you
specify what version of the framework your application is targeting?
Ans. In Asp.Net 4 a new element "targetFramework" of compilation tag
(in Web.config file) lets you specify the framework version in the webconfig
file as
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
</configuration>
It only lets you target the .NET Framework 4.0 and later verisons.
Q. What is the use
of MetaKeywords and MetaDescription properties.
Ans. MetaKeywords and MetaDescription are the new properties added to the Page
class of ASP.NET 4.0 Web Forms. The two properties are used to set the keywords
and description meta tags in your page.
For e.g.
<meta name="keywords" content="These, are, my, keywords"
/>
<meta name="description" content="This is the description of
my page" />
You can set these properties at run time, which lets you get the content from a
database or other source, and which lets you set the tags dynamically to
describe what a particular page is for.
You can also set the Keywords and Description properties in the @ Page
directive at the top of the Web Forms page markup like,
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" Keywords="ASP,4.0,are keywords"
Description="blah blah" %>
Q. What is Microsoft
Ajax Library.
Ans. Microsoft Ajax Library is a client-only JavaScript library that is
compatible with all modern browsers, including Internet Explorer, Google
Chrome, Apple Safari, and Mozilla Firefox.Because the Microsoft Ajax Library is
a client-only JavaScript library, you can use the library with both ASP.NET Web
Forms and ASP.NET MVC applications. You can also create Ajax pages that consist
only of HTML.
Q. What are the
Changes in CheckBoxList and RadioButtonList Control ?
Ans. In ASP.NET 4, the CheckBoxList and RadioButtonList controls support two
new values for the RepeatLayout property, OrderedList(The content is rendered
as li elements within an ol element) and UnorderedList(The content is rendered
as li elements within a ul element.)
For more info see : Specify
Layout in CheckBoxList and RadioButtonList Control - ASP.Net 4
Q. Whats Application
Warm-Up Module?
Ans. We can set-up a Warm-Up module for warming up your applications before
they serve their first request.Instead of writing custom code, you specify the
URLs of resources to execute before the Web application accepts requests from
the network. This warm-up occurs during startup of the IIS service (if you
configured the IIS application pool as AlwaysRunning) and when an IIS worker
process recycles. During recycle, the old IIS worker process continues to
execute requests until the newly spawned worker process is fully warmed up, so
that applications experience no interruptions or other issues due to unprimed
caches.
Q.Whats an assembly?
Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.
Q.Describe the difference between inline and code behind
– which is best in a loosely coupled solution? ASP.NET supports two modes of page development: Page logic code that is written inside <script runat=server> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked “behind” the .aspx file at run time.
Q.Explain what a diffgram is, and a good use for one?
A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
Q.Where would you use an iHTTPModule, and what are the limitations of anyapproach you might take in implementing one? One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
Q.In what order do the events of an ASPX page execute. As a developer is it important to undertsand these events?
Every Page object (which your .aspx page is) has nine events, most of which you will not have to worry about in your day to day dealings with ASP.NET. The three that you will deal with the most are: Page_Init, Page_Load, Page_PreRender.
Q.Which method do you invoke on the DataAdapter control to load your generated dataset with data?
System.Data.Common.DataAdapter.Fill(System.Data.DataSet);
If my DataAdapter is sqlDataAdapter and my DataSet is dsUsers then it is called this way:
sqlDataAdapter.Fill(dsUsers);
Which template must you provide, in order to display data in a Repeater control? ItemTemplate
How can you provide an alternating color scheme in a Repeater control?
AlternatingItemTemplate Like the ItemTemplate element, but
rendered for every other
row (alternating items) in the Repeater control. You can specify a different
appearance
for the AlternatingItemTemplate element by setting its style properties.
Q.What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?
You must set the DataMember property which Gets or sets the specific table in the DataSource to bind to the control and the DataBind method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query.
Q.What base class do all Web Forms inherit from?
System.Web.UI.Page
Q.What method do you use to explicitly kill a user’s session?
The Abandon method destroys all the objects stored in a
Session object and releases their resources.
If you do not call the Abandon method explicitly, the server destroys these
objects when the session times out.Syntax: Session.Abandon
Q.How do you turn off cookies for one page in your
site?
Use the Cookie.Discard Property which Gets or sets the discard flag set by the
server. When true, this
property instructs the client application not to save the Cookie on the user’s
hard disk when a session ends.
Q.Which two properties are on every validation control? ControlToValidate & ErrorMessage properties
How do you create a permanent cookie? Setting the Expires property to MinValue means that the Cookie never expires.
Q.Which method do you use to redirect the user to another page without performing a round trip to the client?
Server.transfer()
Q.What is the transport protocol you use to call a Web service?
SOAP. Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. This in fact imposes the usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of transports. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service. Also, the message format should allow for extensions and different bindings to specific transport protocols. SOAP and ebXML Transport are specifications which fulfill these requirements. We expect that the W3C XML Protocol Working Group defines a successor standard.
True or False: A Web service can only be written in .NET. False.
Q.What does WSDL stand for?
Web Services Description Language
Q.What property do you have to set to tell the grid which page to go to when using the Pager object?
Where on the Internet would you look for Web services? UDDI repositaries like uddi.microsoft.com, IBM UDDI node, UDDI Registries in Google Directory, enthusiast sites like XMethods.net.
What tags do you need to add within the asp:datagrid tags to bind columns manually?
Column tag and an ASP:databound tag.
How is a property designated as read-only? In VB.NET:
Public ReadOnly Property PropertyName As ReturnType
Get ‘Your Property Implementation goes in here
End Get
End Property
in C# public returntype PropertyName { get { //property implementation goes here }// Do not write the set implementation}
Q.Which control would you use if you needed to make sure the values in two different controls matched?
Use the
CompareValidator control to compare the values
of 2 different controls.
True or False: To test a Web service you must create a windows application or Web application to consume this service? False
Q. Explain how a web application works.
A web application resides in the server and serves the client’s requests over internet. The client
access the web page using browser from his machine. When a client makes a request, it receives
the result in the form of HTML which are interpreted and displayed by the browser.
A web application on the server side runs under the management of Microsoft Internet
Information Services (IIS). IIS passes the request received from client to the application. The
application returns the requested result in the form of HTML to IIS, which in turn, sends the result to the client.
Q. Explain the
advantages of ASP.NET.
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-sideprogramming model.
Q.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 progra 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.
Q. Explain the
different parts that constitute ASP.NET application.
Content:-, program logic and configuration
file constitute an ASP.NET application.Content
files:-
Content files include static text, images and can include
elements from database.Program logic:-
Program logic files exist as DLL file on the server that
responds to the user actions.Configuration
file:-
Configuration file offers various settings that determine how
the application runs on the server.
Q. Describe the
sequence of action takes place on the server when ASP.NET application
starts first time?
Following are the sequences:
IIS starts ASP.NET worker process>> worker process
loads assembly in the memory>>IIS sends
the request to the assembly>>the assembly composes a
response using program logic>> IIS
returns the response to the user in the form of HTML.
Q. Explain the
components of web form in ASP.NET
Server controls.
The server controls are Hypertext Markup Language (HTML)
elements that include a runat=server attribute. They provide automatic state
management and server-side events and respond to the user events by executing
event handler on the server.HTML controls.
These controls also respond to the user events but the events
processing happen on the clientmachine. Data controls Data controls allow
to connect to the database, execute
command and retrieve data from database.System components
System components provide access to system-level events that
occur on the server.
Q. Describe in brief
.NET Framework and its components.
.NET Framework provides platform for developing windows and
web software. ASP.NET is a part of .Net framework and can access all features
implemented within it that was formerly available only through windows API.
.NET Framework sits in between our application programs andoperating system.
The .Net Framework has
two main components:
.Net Framework Class Library: It provides common types such
as data types and object types that can be shared by all .Net compliant language.The
Common language Runtime: It provides services like type safety, security, code
execution,
thread management, interoperability services.
Q. What is an Assembly?
Explain its parts?
An assembly exists as a .DLL or .EXE that contains MSIL code
that is executed by CLR.An assembly contains interface and classes, it can also
contain other resources like bitmaps, files etc. It carries version details
which are used by the CLR during execution. Two assemblies of the same name but
with different versions can run side-by-side enabling applications that depend
on a specific version to use assembly of that version. An assembly is the unit
on which permissions are granted. It can be private or global. A private
assembly is used only by the application to which it belongs, but the global
assembly can be used by any application in the system.
The four parts of an assembly are: Assembly Manifest - It
contains name, version, culture, and information about referenced
assemblies.Type metadata - It contains information about
types defined in the assembly.MSIL - MSIL code.
Resources - Files such as BMP or JPG file or any other files
required by application.
Q. Define Common Type
System.
.Net allows developers to write program logic in at least 25
languages. The classes written in one language can be used by other languages
in .Net. This service of .Net is possible through CTS which ensure the rules
related to data types that all language must follow. It provides set of types that
are used by all .NET languages and ensures .NET language type compatibility.
Q. Define Virtual
folder.
It is the folder that contains web applications. The folder
that has been published as virtual folder
by IIS can only contain web applications.
Q. Describe the Events
in the Life Cycle of a Web Application
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.
Q. What are the ways of
preserving data on a Web Form in ASP.NET?
ASP.NET has introduced view state to preserve data between postback
events. View state can.t avail data to other web form in an application. To
provide data to other forms, you need to save data in a state variable in the
application or session objects.
Q. Define application
state variable and session state variable.
These objects provide two levels of scope:
Application State Data stored in the application object can
be shared by all the sessions of the application.Application object stores data
in the key value pair. Session State Session State stores session-specific
information and the information is visible within the session only. ASP.NET
creates unique sessionId for each session of the application. SessionIDs aremaintained
either by an HTTP cookie or a modified URL, as set in the application’s
configuration settings. By default, SessionID values are stored in a cookie.
Q. Describe the
application event handlers in ASP.NET
Following are the application event handlers:
Application_Start: This event occurs when the first user
visits a page of the application.
Application_End: This event occurs when there are no more
users of the application.
Application_BeginRequest: This occurs at the beginning of
each request to the server.
Application_EndRequest: occurs at the end of each request to
the server.
Session_Start: This event occurs every time when any new user
visits.
Session_End: occurs when the users stop requesting pages and
their session times out.
Q. What are the Web
Form Events available in ASP.NET?
Page_Init ,Page_Load ,Page_PreRender,Page_Unload,Page_Disposed,Page_Error,Page_AbortTransaction,Page_CommitTransaction,Page_DataBinding
Q. Describe the Server
Control Events of ASP.NET.
ASP.NET offers many server controls like button, textbox, DropDownList
etc. Each control can respond to the user.s actions using events and event
handler mechanism.There are three types of server control events: Postback events
This events sends the web page to the server for processing. Web page sends
data back to the same page on the server. Cached events These events are
processed when a postback event occurs.Validation events These events occur
just before a page is posted back to the server.
Q. How do you change
the session time-out value?
The session time-out value is specified in the web.config file
within sessionstate element.You can change the session time-out setting by
changing value of timeout attribute of sessionstate element in web.config file.
Q. Describe how ASP.NET
maintains process isolation for each Web application?
In ASP.NET, when IIS receives a request, IIS uses
aspnet_isapi.dll to call the ASP.NET worker process (aspnet_wp.exe). The
ASP.NET worker process loads the Web application.s assembly,allocating one
process space, called the application domain, for each application. This is the
how ASP.NET maintains process isolation for each Web application.
Q. Define namespace.
Namespaces are the way to organize programming code. It
removes the chances of name conflict. It is quite possible to have one name for
an item accidentally in large projects those results into conflict. By
organizing your code into namespaces, you reduce the chance of these
conflicts. You can create namespaces by enclosing a class in
a Namespace.End Namespace block.You can use namespaces outside your project by
referring them using References dialog box.You can use Imports or using
statement to the code file to access members of the namespaces in code.
Q. What are the options
in ASP.NET to maintain state?
Client-side state management
This maintains information on the client’s machine using
Cookies, View State, and Query Strings.
Cookies.
A cookie is a small text file on the client machine either in
the client’s file system or memory of client browser session. Cookies are not
good for sensitive data. Moreover, Cookies can be disabled on the browser.
Thus, you can’t rely on cookies for state management.
View State
Each page and each control on the page has View State
property. This property allows automatic
retention of page and controls state between each trip to server. This
means control value is maintained between page postbacks. Viewstate is
implemented using _VIEWSTATE, a hidden
form field which gets created automatically on each page. You
can’t transmit data to other page using view state.
Querystring
Query strings can maintain limited state information. Data
can be passed from one page to another with the URL but you can send limited
size of data with the URL. Most browsers allow a limit of 255 characters on URL
length.
Server-side state
management
This kind of mechanism retains state in the server.
Application State
The data stored in the application object can be shared by
all the sessions of the application. Application object stores data in the key
valuepair
Session State
Session State stores session-specific information and the
information is visible within the session only. ASP.NET creates unique
sessionId for each session of the application. SessionIDs are maintained either
by an HTTP cookie or a modified URL, as set in the application’s configuration settings.
By default, SessionID values are stored in a cookie.
Database
Database can be used to store large state information.
Database support is used in combination with cookies or session state.
Q. Explain the
difference between Server control and HTML control.
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.
Q. What are the
validation controls available in ASP.NET?
ASP.NET validation controls are:
RequiredFieldValidator: This validates controls if controls
contain data.
CompareValidator: This allows checking if data of one control
match with other control.
RangeValidator: This verifies if entered data is between two
values.
RegularExpressionValidator: This checks if entered data
matches a specific format.
CustomValidator: Validate the data entered using a
client-side script or a server-side code.
ValidationSummary: This allows developer to display errors in
one place.
Q. Define the steps to
set up validation control.
Following are the steps to set up validation control Drag a
validation control on a web form. Set the ControlToValidate property to the
control to be validated. If you are using CompareValidator, you have to specify
the ControlToCompare property. Specify the error message you want to display
using ErrorMessage property. You can use ValidationSummary control to show
errors at one place.
Q. What are the
navigation ways between pages available in ASP.NET?
Ways to navigate between pages are:
Hyperlink control
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open script method
Q. How do you open a
page in a new window?
To open a page in a new window, you have to use client script
using onclick="window.open()" attribute of HTML control.
Q. Define
authentication and authorization.
Authorization: The process of granting access privileges to
resources or tasks within an application.
Authentication: The process of validating the identity of a
user.
Q. Define caching.
Caching is the technique of storing frequently used items in
memory so that they can be accessed more quickly. Caching technique allows to store/cache
page output or application data on the client on the server. The cached
information is used to serve subsequent requests that
avoid the overhead of recreating the same information. This
enhances performance when same information is requested many times by the user.
Q. Define cookie.
A cookie is a small file on the client computer that a web
application uses to maintain current session information. Cookies are used to
identity a user in a future session.
Q. What is delegate?
A delegate acts like a strongly type function pointer.
Delegates can invoke the methods that they reference without making explicit
calls to those methods. It is type safe since it holds reference of only those
methods that match its signature. Unlike other classes, the delegate class has
a signature. Delegates are used to implement event programming model in .NET
application.Delegates enable the methods that listen for an event, to be
abstract.
Q. Explain Exception
handling in .Net.
Exceptions or errors are unusual occurrences that happen
within the logic of an application. The CLR has provided structured way to deal
with exceptions using Try/Catch block. ASP.NET supports some facilities to
handling exceptions using events suck as Page_Error and
Application_Error.
Q. What is
impersonation?
Impersonation means delegating one user identity to another
user. In ASP.NET, the anonymous users impersonate the ASPNET user account by
default. You can use <identity> element of web.config file to impersonate
user. E.g. <identity impersonate="true"/>
Q. What is managed code
in .Net?
The code that runs under the guidance of common language
runtime (CLR) is called managed code. The versioning and registration problem
which are formally handled by the windows programming are solved in .Net with
the introduction of managed code. The managed code
contains all the versioning and type information that the CLR
use to run the application.
Q. What are Merge
modules?
Merge modules are the deployment projects for the shared
components. If the components arealready installed, the modules merge the
changes rather than unnecessarily overwrite them.When the components are no
longer in use, they are removed safely from the server using Merge modules
facility.
Q. What is Satellite
assembly?
Satellite assembly is a kind of assembly that includes
localized resources for an application. Each
satellite assembly contains the resources for one culture.
Q. Define secured
sockets layer.
Secured Socket Layer (SSL) ensures a secured web application
by encrypting the data sent over
internet. When an application is using SSL facility, the
server generates an encryption key for the
session and page is encrypted before it sent. The client
browse uses this encryption key to
decrypt the requested Web page.
Q. Define session in
ASP.NET.
A session starts when the browser first request a resources
from within the application. The session gets terminated when either browser
closed down or session time out has been attained. The default time out for the
session is 20 minutes.
36. Define Tracing.
Tracing is the way to maintain events in an application. It
is useful while the application is in debugging or in the testing phase. The
trace class in the code is used to diagnose problem. You can use trace messages
to your project to monitor events in the released version of the
application. The trace class is found in the
System.Diagnostics namespace. ASP.NET introduces tracing that enables you to
write debug statements in your code, which still remain in the code even after
when it is deployed to production servers.
Q. Define View State.
ASP.NET preserves data between postback events using view
state. You can save a lot of coding using view state in the web form. ViewState
serialize the state of objects and store in a hidden field on the page. It
retains the state of server-side objects between postbacks.
It represents the status of the page when submitted to the
server. By default, view state is maintained for each page. If you do not want
to maintain the ViewState, include the directive <%@ Page
EnableViewState="false" %> at the top of an .aspx page or add the
attribute
EnableViewState="false" to any control. ViewState
exist for the life of the current page.
Q. What is application
domain?
It is the process space within which ASP.NET application
runs. Every application has its own process space which isolates it from other
application. If one of the application domains throws error it does not affect
the other application domains.
Q. List down the
sequence of methods called during the page load.
Init() . Initializes the page.
Load() . Loads the page in the server memory.
PreRender() - the brief moment before the page is displayed
to the user as HTML
Unload() . runs just after page finishes loading.
Q. What is the
importance of Global.asax in ASP.NET?
The Global.asax is used to implement application and session
level events.
Q. Define MSIL.
MSIL is the Microsoft Intermediate Language. All .Net
languages. executable exists as MSIL which gets converted into machine specific
language using JIT compiler just before execution.
Q. Response.Redirect vs
Server.Transfer.
Server.Transfer is only applicable for aspx files. It
transfers page processing to another page without making round-trip back to the
client.s browser. Since no round trips, it offers faster response and doesn.t
update client url history list. Response.Redirect is used to redirect to
another page or site. This performs a trip back to the client where the
client’s browser is redirected to the new page.
Q. Explain Session
state management options in ASP.NET.
ASP.NET provides In-Process and Out-of-Process state
management. In-Process stores the session in memory on the web server.
Out-of-Process Session state management stores data in an external data source
such as SQL Server or a State Server service. Out-of-Process state
management requires that all objects stored in session are
serializable.
Q. How to turn off
cookies for a page?
Cookie.Discard Property when true, instructs the client
application not to save the Cookie on the user.s hard disk when a session ends.
Q. How can you ensure a
permanent cookie?
Setting Expires property to MinValue and restrict cookie to
get expired.
Q. What is
AutoPostback?
AutoPostBack automatically posts the page back to the server
when state of the control is changed.
Q. Explain login
control and form authentication.
Login controls encapsulate all the features offered by Forms
authentication. Login controls internally use FormsAuthentication class to
implement security by prompting for user credentials validating them.
Q. What is the use of
Web.config file?
Following are the setting you can incorporate in web.config
file.
Database connections,Error
Page setting,Session States, Error Handling,Security,Trace setting,Culture specific setting
Q. Explain in what
order a destructors is called.
Destructors are called in reverse order of constructors.
Destructor of most derived class is called
followed by its parent.s destructor and so on till the
topmost class in the hierarchy.
Q. What is break mode?
What are the options to step through code?
Answer - Break mode lets you to observe code line to line in
order to locate error.
VS.NET provides following option to step through code.
Step Into,Step
Over,Step Out,Run To Cursor,Set Next
Statement
Q. Explain how to
retrieve property settings from XML .config file.
Create an instance of AppSettingsReader class, use GetValue
method by passing the name of
the property and the type expected. Assign the result to the
appropriate variable.
Q. Explain Global
Assembly Cache.
Global Assembly Cache is the place holder for shared
assembly. If an assembly is installed to the Global Assembly Cache, the
assembly can be accessed by multiple applications. In order to install an
assembly to the GAC, the assembly must have to be signed with strong name.
Q. Explain Managed code
an Un-managed code.
Managed code runs under the safe supervision of common
language runtime. Managed code carries metadata that is used by common language
runtime to offer service like memory management, code access security, and
cross-language accessibility.
Unmanaged code doesn.t follow CLR conventions and thus, can.t
take the advantages of.Framework.
Q. What is side-by-side
execution?
This means multiple version of same assembly to run on the
same computer. This feature
enables to deploy multiple versions of the component.
Q. Define Resource
Files.
Resource files contains non-executable data like strings,
images etc that are used by an application and deployed along with it. You can
changes these data without recompiling the whole application.
Q. Define Globalization
and Localization.
Globalization is the process of creating multilingual
application by defining culture specific features like currency, date and time
format, calendar and other issues.Localization is the process of accommodating
cultural differences in an application.
Q. What is reflection?
Reflection is a mechanism through which types defined in the
metadata of each module can be accessed. The System.Reflection namespaces
contains classes that can be used to define the types for an assembly.
Q. Define Satellite
Assemblies.
Satellite Assemblies are the special kinds of assemblies that
exist as DLL and contain culturespecific resources in a binary format. They
store compiled localized application resources. They can be created using the
AL utility and can be deployed even after deployment of the application. Satellite
Assemblies encapsulate resources into binary format and thus makes resources
lighter
and consume lesser space on the disk.
Q. What is CAS?
CAS is very important part of .Net security system which
verifies if particular piece of code is allowed to run. It also determines if
piece of code have access rights to run particular resource..NET security
system applies these features using code groups and permissions. Each assembly of
an application is the part of code group with associated permissions.
Q. Explain Automatic
Memory Management in .NET.
Automatic memory management in .Net is through garbage
collector which is incredibly efficient in releasing resources when no longer
in use.About the author: Nishant Kumar, a Microsoft Certified Professional with
8 years of industrial experience. He also works as a corporate trainer,
currently based in Pune. He can be contacted at www.CareerRide.com is a source of information for technical and
personal aspects of an IT interview for a candidate. It provides easy tutorial
for the candidates to refer before appearing for an interview.
Comments
Post a Comment