ASP.NET Interview Questions and Answers

1) Explain Asp.net

Ans: It is data-access technology, primarily disconnected and designed to provide efficient, scalable data  access.
The disconnected data is represented within a DataSet object.
A data provider is a set of classes that provide access to databases.

The main components of data provider are:
1. Connection
2. Command
3. DataReader
4. DataAdapter

Visual Studio .NET includes two data providers:
1. SQL Data Provider
2. OleDb Data Provider

Two additional data providers are included in Visual Studio .NET 2003:
1. ODBC Data Provider
2. Oracle Data Provider


2) What is CLR?

Ans: Common Language Runtime (CLR) is a run-time environment that manages the execution of .NET code and provides services like memory management, debugging, security, etc.


3) In Visual Studio .NET, how do I create a new ASP.NET application for an existing ASP.NET project?

Ans: First create an IIS application using the IIS MMC. Then in Visual Studio .NET, use the “New Project In Existing Folder” project template (at the end of the template list). It will first ask you for the project name (use the same one you created for the IIS application). Click OK button. Then enter in physical folder location.


4) What is the Difference between HTML controls and ASP.net Controls?

Ans: HTML controls are run on client side, where as ASP.net controls runs on server side and for execute on client side, they generate HTML controls.


5) Can a .NET web application consume Java web service?

Ans: Yes.Actually Webservices are independent to language. it depends on WSDL and SOAP. so any one can develope the Webservices anddisclose the wsdl and users can cosume the webservices.wsdl and soap both are xml based.. and all languages having xml parsing capability and access to http protocol will be able to work with Webservices


6) What’s the difference between Codebehind=”MyCode.aspx.cs” andSrc=”MyCode.aspx.cs”?

Ans: CodeBehind is relevant to Visual Studio.NET only.


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


8) Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler?
Ans:
 It’s the Attributesproperty, the Add function inside that property.

So btnSubmit.Attributes.Add(“onMouseOver”,”someClientCode();”)


9) What data type does the RangeValidator control support?
Ans:
 Integer,String and Date.


10) Explain the differences between Server-side and Client-side code?
Ans:
 Server-side code runs on the server. Client-side code runs in the clients’ browser.


11) What type of code (server or client) is found in a Code-Behind class?
Ans: 
Server-side code.


12) Should validation (did the user enter a real date) occur server-side or client-side? Why?

Ans: Client-side. This reduces an additional request to the server to validate the users input.


13) What does the “EnableViewState” property do? Why would I want it on or off?
Ans: 
It enables the viewstate on the page. It allows the page to save the users input on a form.


14) What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Ans: 
Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.


15) Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Ans:

A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
A DataSet is designed to work without any continuing connection to the original data source.
Data in a DataSet is bulk-loaded, rather than being loaded on demand.
There’s no concept of cursor types in a DataSet.
DataSets have no current record pointer You can use For Each loops to move through the data.
You can store many edits in a DataSet, and write them to the original data source in a single operation.
Though the DataSet is universal, other objects in ADO.NET come in different versions fordifferent data sources.


16) Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
Ans:
 This is where you can set the specific variables for the Application and Session objects.


17) If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?
Ans: 
Maintain the login state security through a database.


18) Can you explain what inheritance is and an example of when you might use it?
Ans:
 When you want to inherit (use the functionality of) another class. Base Class Employee. A Manager class could be derived from the Employee base class.


19) Whats an assembly?
Ans:
 Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN


20) Describe the difference between inline and code behind.
Ans:
 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.


21) Explain what a diffgram is, and a good use for one?
Ans:
 The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. For reading database data to an XML file to be sent to a Web Service.


22) Whats MSIL, and why should my developers need an appreciation of it if at all?
Ans:
 MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.


23) Which method do you invoke on the DataAdapter control to load your generated dataset with data?
Ans: 
The .Fill() method


24) Can you edit data in the Repeater control?
Ans:
 No, it just reads the information from its data source


25) Which template must you provide, in order to display data in a Repeater control?

Ans: ItemTemplate


26) How can you provide an alternating color scheme in a Repeater control?
Ans: 
Use the AlternatingItemTemplate


27) 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?
Ans:
 You must set the DataSource property and call the DataBind method.


28) What base class do all Web Forms inherit from?
Ans
: The Page class.


29) Name two properties common in every validation control?
Ans: 
ControlToValidate property and Text property.


30) What tags do you need to add within the asp:datagrid tags to bind columns manually?
Ans: 
Set AutoGenerateColumns Property to false on the datagrid tag


31) What tag do you use to add a hyperlink column to the DataGrid?
Ans:
 Anchor tag is used to add a hyperlink column to the datagrid


32) What is the transport protocol you use to call a Web service?
Ans: 
SOAP is the preferred protocol.


33) True or False: A Web service can only be written in .NET?
Ans: 
False


34) What does WSDL stand for?
Ans:
 Web Services Description Language


35) Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
Ans:
 DataTextField property


36) Which control would you use if you needed to make sure the values in two different controls matched? 

 Ans: CompareValidator Control


37) To test a Web service you must create a windows application or Web pplication to consume this service?
Ans: 
False, the webservice comes with a test page and it provides HTTP-GET method to test.


38) How many classes can a single .NET DLL contain?
Ans:
 It can contain many classes.


39) Describe the role of inetinfo.exe, aspnet_isapi.dll and aspnet_wp.exe in the page loading process.
Ans:
 inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests. When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.


40)  What’s the difference between Response.Write() and Response.Output.Write()?
Ans:
 The latter one allows you to write formattedoutput.


41) What methods are fired during the page load?
Ans:
 Init() – when the page is instantiated, Load() – when the page is loaded into server memory,PreRender() – the brief moment before the page is displayed to the user asHTML, Unload() – when page finishes loading.


42) Where does the Web page belong in the .NET Framework class hierarchy?
Ans:
 System.Web.UI.Page


43) Where do you store the information about the user’s locale?
Ans:
 System.Web.UI.Page.Culture


44)  What’s the difference between Codebehind=”MyCode.aspx.cs” and Src=”MyCode.aspx.cs”?
Ans: 
CodeBehind is relevant to Visual Studio.NET only.


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


46) Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler?
Ans:
 It’s the Attributes property, The Add function inside that property.

So btnSubmit.Attributes.Add(“onMouseOver”,”someClientCode();”)


47) What data type does the RangeValidator control support?
Ans:
 Integer, String and Date.


48) Explain the differences between Server-side and Client-side code?
Ans:
 Server-side code runs on the server. Client-side code runs in the clients’ browser.


49) What type of code (server or client) is found in a Code-Behind class?
Ans:
 Server-side code.


50) Should validation (did the user enter a real date) occur server-side or client-side? Why?
Ans:
 Client-side. This reduces an additional request to the server to validate the users input.


51) What does the “EnableViewState” property do? Why would I want it on or off?
Ans:
 It enables the viewstate on the page. It allows the page to save the users input on a form.


52)  What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Ans: 
Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site.


53) Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Ans:

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

A DataSet is designed to work without any continuing connection to the original data source.

Data in a DataSet is bulk-loaded, rather than being loaded on demand.

There’s no concept of cursor types in a DataSet.

DataSets have no current record pointer You can use For Each loops to move through the data.

You can store many edits in a DataSet, and write them to the original data source in a single operation.

Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.


54) Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines?
Ans:
 This is where you can set the specific variables for the Application and Session objects.


55) If I’m developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?
Ans:
 Maintain the login state security through a database.


56) Can you explain what inheritance is and an example of when you might use it?
Ans:
 When you want to inherit (use the functionality of) another class. Base Class Employee
A Manager class could be derived from the Employee base class.


57)  Whats an assembly?
Ans:
 Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN


58) Describe the difference between inline and code behind.
Ans:
 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.


59) Explain what a diffgram is, and a good use for one?
Ans:
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.
For reading database data to an XML file to be sent to a Web Service.


60) Whats MSIL, and why should my developers need an appreciation of it if at all?
Ans:
 MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL.


61) Which method do you invoke on the DataAdapter control to load your generated dataset with data?
Ans:
 The .Fill() method


62) Can you edit data in the Repeater control?
Ans: 
No, it just reads the information from its data source


63) Which template must you provide, in order to display data in a Repeater control?
Ans: 
ItemTemplate


64) How can you provide an alternating color scheme in a Repeater control?
Ans: 
Use the AlternatingItemTemplate


65) 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?
Ans: 
You must set the DataSource property and call the DataBind method.


66) What base class do all Web Forms inherit from?
Ans: 
The Page class.


 67) Name two properties common in every validation control?
Ans: 
ControlToValidate property and Text property.


68) What tags do you need to add within the asp:datagrid tags to bind columns manually?
Ans: 
Set AutoGenerateColumns Property to false on the datagrid tag


69) What is the transport protocol you use to call a Web service?
Ans:
 SOAP is the preferred protocol.


70) A Web service can only be written in .NET?
Ans: 
False


71) Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
Ans: 
DataTextField property


72) Which control would you use if you needed to make sure the values in two different controls matched?
Ans: 
CompareValidator Control


73) To test a Web service you must create a windows application or Web application to consume this service?
Ans:
 False, the webservice comes with a test page and it provides HTTP-GET method to test.


74) How many classes can a single .NET DLL contain?
Ans:
 It can contain many classes.


75) Briefly explain how code behind works and contrast that using the inline style.
Ans:

Many of the web developers that are currently moving to ASP.NET were previously ASP developers, which made them used to developing their script code inline with the HTML.
This coding style of using inline code is still available within the ASP.NET framework, but a new coding style designed for large team development has also been introduced with ASP.NET this has been dubbed code-behind.
This coding style places all the code that is to be executed by the server into separate files for each .aspx page.

This allows web designers who specialize in the HTML development of a site, and application developers who specialize in the programming logic of the site to work together in a way that the page designer does not disturb the code in the page. This also allows a company who is interested in protecting it’s investment or who are developing web applications for resale to distribute just the .aspx files and the compiled code-behind files as a .dll file for the site.

There are three ways of working with .aspx pages.
1. Inline code that is compiled on the web server as it is needed.
2. Code-behind files that are compiled into a .dll file and then removed from production.
3. Code-behind files that are compiled on the web server as they are needed.
With these options in mind it becomes very important to consider how a developer will work with .aspx pages in ASP.NET.


76)  What is a DataReader?

Ans: A DataReader is a read-only stream of data returned from the database as the query executes. It only contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time. The DataReader does support access to multiple result sets, but only one at a time and in the order retrieved. Just as in the original version of ADO, the data is no longer available through the DataReader once the connection to the data source is closed, which means a DataReader requires a connection to the database throughout its usage. Output parameters or return values are only available through the DataReader once the connection is closed.


77) Briefly explain how the server control validation controls work.
Ans: 
User Input Validation
ASP.NET provides a set of Web server controls called validation controls that provide sophisticated validation on both the client side and the server side depending on the validation settings and the browser’s capabilities.

ASP.NET ensures that validations are performed on the server side even if they were already performed on the client side. This ensures that validations are not bypassed if a malicious user circumvents client-side validation. If the client-side validation fails, the server-side validation is never performed.

Some validator controls are:

  1. Requiredfieldvalidator
  2. RangeValidator
  3. CompareValidator
  4. RegularExpressionValidator
  5. CustomValidator
  6. ValidationSummary

you may want to mention about Page.Validate() Method and Page.IsValid Property.


78) Briefly explain what user controls are and what server controls are and the differences between the two.
Ans:
 A user control could simply be an extension of the functionality of an existing server control(s) (such as an image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist of several elements that work and interact together to get a job done (such as several controls grouped together that gather information about a user’s previous work experience).

An ASP.NET control (sometimes called a server control) is a server-side component that is shipped with .NET Framework. A server control is a compiled DLL file and cannot be edited. It can, however, be manipulated through its public properties at design-time or runtime. It is possible to build a custom server control (sometimes called a custom control or composite control).

In contrast, a user control will consist of previously built server controls (called constituent controls when used within a user control). It has an interface that can be completely edited and changed. It can be manipulated at design-time and runtime via properties that you are responsible for creating. While there will be a multitude of controls for every possible function built by third-party vendors for ASP.NET, they will exist in the form of compiled server controls, as mentioned above. Custom server controls may be the .NET answer to ActiveX Web controls.


79) Briefly explain how server form post-back works (perhaps ask about view state as well).
Ans: 
One of the most important features of the ASP.NET environment is the ability to declare controls that run on the server, and post back to the same page. Remember the days of classic ASP? We would create a form which would accept the user’s input, and then we would most probably have to create another page that would accept all those inputs, either through HTTP GET or POST, and perform some kind of validation, display and action. Sometimes, even a third page was necessary to perform our actions.

This wasted a lot of time and complicated things when you had to make a change. But of course, this is not necessary any more with ASP.NET. There is no need to create second pages that accept the inputs of the first, process them and so on. Form fields and other controls can be declared to run on the server, and the server simply posts the page back to itself and performs all the validation, display and actions.

Our life as web developers has become a million times better. But how exactly is this done?

When a control is declared to run on the server, a VIEWSTATE is created which remembers the ID of that control, and the method to call when an action is performed.submit event calls the javascript function _doPostBack (that’s 2 underscore symbols in front of it). You do not write this function, instead it is generated by the ASP.NET engine and automatically included in our page. It submits the form to the same page, and accepts 2 arguments:

eventTarget: the control doing the submission
eventArgument: any additional information for the event

At least one control needs to be set to Visible, for the server to generate the_doPostBack function in our page. Even if we have numerous web controls declared to run on the server, but they are all set to Visible=false, then the javascript function will not be included and we will not be able to perform any actions.


80) Can the action attribute of a server-side tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page. (Extra credit: Have you heard of comdna.
Ans:
 .NET pages are set to postback to themselves by default and this cannot be changed. You must process your form data in the same page if you want to use .NET controls. It’s the way it works.

Will not work. Your form action will be over-written to the current page no matter what you try. Unless of course you remove the runat=”server” which then means you are using forms under Classic ASP again and .NET features like validation controls will be ignored.

If you truly want to move to another page when you submit your form you can. However; you must process the form data from the page you are on first. Then redirect to the next page using Response.Redirect or Server.Transfer. If you care to pass the form values to the next page then you must do it in the query string.


81)  Briefly describe the role of global.asax.
Ans: 
The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in the root directory of an ASP.NET-based application. At run time, Global.asax is parsed and compiled into a dynamically generated .

NET Framework class derived from the HttpApplication base class. The Global.asax file itself is configured so that any direct URL request for it is automatically rejected; external users cannot download or view the code written within it. global.asax is responsible for handling higher-level application events such as Application_Start, Application_End, Session_Start, Session_End


82) What is the correct language to code ASP.NET pages with?
Ans:
 (The only correct answer would be C#. 🙂 Maybe this should be the first question.


83)  What is the root namespace for all types?
Ans: 
System.


84) What is CLR ? Differentiate between CLR & CTS.
Ans: 
Common Language Runtime. The CLR is a set of standard resources responsible for execution of code developed using .NET language. .Net compiler generates intermediate language (IL) which is then compiled using JIT to m/c code. It provides access to common functionalities to all languages via Base Class Libraries. CLR is replacement to win32 APICross-language integration, especially cross-language inheritance.

Automatic memory management (garbage collection), which manages object lifetime so that reference counting is unnecessary. Self-describing objects, which make using Interface Definition Language (IDL) unnecessary. The ability to compile once and run on any CPU and operating system that supports the runtime Common Language Specification.

This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language. In theory this allows very tight interop between different .NET languages – for example allowing a C# class to inherit from a VB class.


85) To which namespaces do Trace and Debug belong?
Ans: 
Systems.Diagnostics


86) To which namespaces does ColumnMapping belong?
Ans: 
[System.Data namespace] [DataColumn class] ColumnMapping


87) DIfferentiate between Friend and Protected Friend.
Ans:
 The five access types are Public, Protected, Friend, Protected Friend, and Private.
Entities declared with the Public modifier have Public access. There are no restrictions on the use of Public entities.
Entities declared with the Protected modifier have Protected access. Protected access can only be specified on members of classes (both regular type members and nested classes) or on Overridable members of standard modules and structures (which must, by definition, be inherited from System.Object or System.ValueType). A Protected member is accessible to a derived class, provided that either the member is not an instance member, or the access takes place through an instance of the derived class. Protected access is not a superset of Friend access.
Entities declared with the Friend modifier have Friend access. An entity with Friend access is accessible only within the program that contains the entity declaration.
Entities declared with the Protected Friend modifiers have the union of Protected and Friend access.
Entities declared with the Private modifier have Private access. A Private entity is accessible only within its declaration context, including any nested entities.


88) What is an abstract class?
Ans:
 Abstract class is a class that has no direct instances, but whose descendants may have direct instances. There are case i which it is useful to define classes for which the programmer never intends to instantiate any objects; because such classes normally are used as bae-classes in inheritance hierarchies, we call such classes abstract classes These classes cannot be used to instantiate objects; because abstract classes are incomplete. Derived classes called concrete classesmust define the missing pieces.

Note : Virtual method has an implementation & provide the derived class with the option of overriding it. Abstract method does not provide an implementation & forces the derived class to override the method.


89) What is the difference between abstract class and an interface? What is shadowing ? Differentiate between Overriding and Overloading.
Ans:
 Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. An interface represents a contract, and a class that implements an interface must implement every aspect of that interface exactly as it is defined.

It is important to note here that an interface is very different from a base class. An interface is implemented, not extended.
1. A class can implement multiple interfaces.
2. An interface cannot contain data declarations but you can declare properties.
3. All method declarations in an interface are public.
4. There can be no implementation in an interface.
5. The class implementing the interface must provide implementation code.
6. An interface can be derived from another interface

An abstract class is a class that cannot be instantiated, but must be inherited from. An abstract class may be fully implemented, but is more usually partially implemented or not implemented at all, thereby encapsulating common functionality for inherited classes.

When you have a class that contains methods that have no implementation (i.e. abstract methods), the class is said to be abstract as well. An abstract method is simply a shell or place-marker for a method that will be defined later in a derived class. The intention of abstract methods is to force every derivation of the class to implement those methods. If a derived class does not implement an abstract method, then that class must also be declared as abstract.

Shadowing is used when 2 programmers come up with same method in the same class one of the methods gets shadowed by scope or inheritance.

Overriding – you override a virtual class.
Overloading – you overload a method with different number of parameters or different type of parameters.


90)  Differentiate between Dataset and Recordset.
Ans:
 Similar to the DataSet, a Recordset could be disconnected from its data store and therefore act as an in-memory cache of data. Of course, it could also be used in a connected model depending on the cursor options that were set. Although the Recordset object stored multiple versions of each column for each of its rows, it was not by nature able to represent multiple tables without the use of the Data Shape Provider. The Recordset was not XML-based and could not be serialized to XML easily or flexibly. Finally, a Recordset was not independent of a data store because it tracked a Connection object and through its methods could send queries to the data source to populate, update, and refresh its data. To that end, the Recordset contained functionality found in the ADO.NET DataSet, data reader, and data adapter objects.


91) Why is Datareader considered useful?
Ans:
 A DataReader is a read-only stream of data returned from the database as the query executes. It only contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time. The DataReader does support access to multiple result sets, but only one at a time and in the order retrieved. Just as in the original version of ADO, the data is no longer available through the DataReader once the connection to the data source is closed, which means a DataReader requires a connection to the database throughout its usage. Output parameters or return values are only available through the DataReader once the connection is closed.


92) What is DLL hell?
Ans:
 Most of you have probably experienced DLL Hell, though you may not have heard of it described as such. If not, you’ve probably heard horror stories from friends or colleagues. The story goes something like this: An end-user or customer calls. Your program is behaving strangely, or no longer loads. Did another program install an older DLL, VBX or ActiveX file on their system? Or maybe a newer, but incompatible version? Is it a conflict due to an incompatible DLL already loaded in memory? Has the PATH environment setting changed? Is the file properly registered in the registry? Is a required file missing? You can literally spend hours trying to figure out what is wrong with a customer’s machine, and why their applications will no longer run.

Every application was self-contained. A program would consist of a single executable (EXE) file. Complex applications might consist of several executables that were chained to each other. One thing, however, was certain – the executables that accompanied a particular application could be used only by that application. For most programs, you could distribute all of the files used by that program without being concerned that other products might interfere with yours.

In the past few years the size of application files has grown dramatically. The Windows operating environment took advantage of a capability called dynamic linking to allow code modules to be shared by applications. The most important demonstration of the use of this capability is Windows itself – the code modules that contain the functions that make Windows work (the Windows API), are shared by all Windows applications. A code module that can be shared in this way is called a dynamic link library and normally has the extension .DLL.


93) What is versioning in .NET?
Ans: 
Each assembly has a four-part version number as part of its identity. Including the version as part of the identity is essential to distinguish different versions of an assembly for the purposes of side-by-side.

This compatibility version number is physically represented as a 4-part number with the following format:

MajorVersion.MinorVersion.BuildNumber.Revision.
The parts of the version number are major, minor, build and revision. There are no semantics applied to the parts of the version number. That is, the common language runtime does not infer compatibility or any other characteristic of an assembly based on how the version number is assigned (version 1.0.0.0 of some assembly and version 2.1.0.2 are completely different identities as far as the class loader is concerned).

As a developer you are free to change any portion of this number as you see fit. Even though there are no semantics applied to the format of the version number, individual organizations will likely find it useful to establish conventions around how the version number is changed.

This helps maintain consistency throughout an organization and makes it easier to determine things like which build a particular assembly came from. One typical convention is as follows:

Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0. Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether.

Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases.

Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You’ll sometimes hear this referred to as the “emergency bug fix” number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.


94) What are the ASP.NET list controls and differentiate between them?
Ans:
 In real-world web applications most of the time data is retrieved from the database source and displayed in tabular or list format. In theory we got to be spending most of our time solving application logic but in practice we spend most of the time in managing the state of the data between web pages and displaying the data. It looks like Microsoft has been listening to these problems ;asp.net provides new set of list controls like Repeater, DataList and DataGrid which will help the developers save lot of time in this area. All these controls are built with a specific purpose in mind. It’s good to know the purpose of the controls so as to reap the maximum benefit from these controls.

These controls have the data binding property where you can retrieve data from the database and bind to the control and define how you want the data to look like and the rest of the work is done with great ease. Let us start looking closely and find what each one of these controls has to offer.

Repeater control is one of the simplest among the controls. It basically iterates through the bound-data and displays it in a single list. All we got to do is just bind the data to the Repeater control and tell the control how we want the data to look like using controls Template. This is useful for;example to display list of employees, products, articles where there is no sorting, editing and paging of data is needed.

DataList is one step a head of the repeater control, it can do all that repeater can do and has additional flexibility to control the layout of the list. For example this has features where you can mention the direction of the list like horizontal,vertical and also select, edit, update and cancel items by using there respective events. This control is very useful when you want to display list of products and also have some additional features like adding then to shopping cart or any other editable capability.

DataGrid control is the most powerful and fascinating among the three controls.It displays data in a tabular from . By default, the DataGrid displays data in read-only mode, but the DataGrid is also capable of automatically displaying the data in editable controls at run-time. The DataGrid control can also create the Select, Edit, Update, and Cancel buttons. Additionally paging, sorting are inbuilt feature. This control can be used whenever we require displaying data in a grid format and requires a whole range of functionality like sorting and paging.


95) Difference between Web User Control and Web Custom Control. 

Ans: If none of the existing ASP.NET server controls meet the specific requirements of your applications, you can create either a Web user control or a Web custom control that encapsulates the functionality you need. The main difference between the two controls lies in ease of creation vs. ease of use at design time.

Web user controls are easy to make, but they can be less convenient to use in advanced scenarios. You develop Web user controls almost exactly the same way that you develop Web Forms pages. Like Web Forms, user controls can be created in the visual designer, they can be written with code separated from the HTML, and they can handle execution events. However, because Web user controls are compiled dynamically at run time they cannot be added to the Toolbox, and they are represented by a simple placeholder glyph when added to a page.

This makes Web user controls harder to use if you are accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view previews. Also, the only way to share the user control between applications is to put a separate copy in each application, which takes more maintenance if you make changes to the control.

Web custom controls are compiled code, which makes them easier to use but more difficult to create; Web custom controls must be authored in code. Once you have created the control, however, you can add it to the Toolbox and display it in a visual designer with full Properties window support and all the other design-time features of ASP.NET server controls. In addition, you can install a single copy of the Web custom control in the global assembly cache and share it between applications, which makes maintenance easier.


96) What is an indexed property?
Ans:
 So, the notion of properties is to define a way to access data that helps code readability while preserving encapsulation. Indexed Properties is a similar notion, however the “friendly” field-like access of regular Properties is replaced with the familiar array-style indexing. Take the ToDo class example below:

using System;
namespace ExampleToDo {
public class ToDo {
private string[] my_tasks;
public ToDo() {
my_tasks = new string[10];
}
public string this[int index] {
get
{
return my_task[index];
}
set
{
return my_task[index] = value;
}
}
}
}

ToDo is a simple class that basically wraps an array of type string. However, notice, the Indexed Property (or indexer) defines access to the array. Thus, you’re providing array-like access to “this” object, the class ToDo. The indexer returns a string and is implemented to index on values of type int. The beauty of indexers is that we could have defined the type we are indexing on to be something else, a string or perhaps a class we have written.

will be glad if any one can explain indexer property. I dont think I understood this clearly.


97) Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
Ans: 
 inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.


98) What’s the difference between Response.Write() andResponse.Output.Write()?
Ans:
 The latter one allows you to write formattedoutput


99) What methods are fired during the page load?
Ans:
 Init() – when the pageis instantiated, Load() – when the page is loaded into server memory,PreRender() – the brief moment before the page is displayed to the user asHTML, Unload() – when page finishes loading.


100) Where does the Web page belong in the .NET Framework class hierarchy?
Ans: 
System.Web.UI.Page


101) Where do you store the information about the user’s locale?
Ans: 
System.Web.UI.Page.Culture


102) how to click or select a row in gridview using c# code?

Ans: We should use the Currency CurrencyManager

cmGrid = (CurrencyManager)this.BindingContext[gridview.DataSource, gridview.DataMember];cmGrid.Position = iIndex;

Naveen E

Naveen E

Author

Hola peeps! Meet an adventure maniac, seeking life in every moment, interacting and writing at Asha24.