ASP.NET Questions

Q. - What is the basic difference between ASP and ASP.NET?

Ans. - The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas ASP.NET is compiled. This implies that since ASP uses VBScript; therefore when an ASP page is executed it is interpreted. On the other hand ASP.NET uses .NET languages such as C# and VB.NET which are compiled to Microsoft Intermediate Language (MSIL).

Q. - What are the advantages of the code-behind feature?

Ans. - The code-behind feature of ASP.NET offers a number of advantages:Makes code easy to understand and debug by separating application logic from HTML tags .Provides the isolation of effort between graphic designers and software engineersRemoves the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.

Q. - What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?

Ans. - When a browser requests an .aspx file then the server returns a response which is rendered into a HTML string.

Q. - What is the difference between authentication and authorization?

Ans. - Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words you can say that authentication is a procedure of getting some credentials from the users and verify the user's identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.

Q. - What is ViewState?

Ans. - The 'ViewState' is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted the first task by the page processing is to restore the ViewState to get the values of the controls.

Q. - What is .NET?

Ans. - NET is an integral part of many applications running on Windows and provides common functionality for those applications to run. This download is for people who need .NET to run an application on their computer. For developers the .NET Framework provides a comprehensive and consistent programming model for building applications that have visually stunning user experiences and seamless and secure communication.

Q. - What is the use of PlaceHolder control? Can we see it at runtime?

Ans. - The PlaceHolder control acts as a container for those controls that are dynamically generated at runtime. We cannot see it at runtime because it does not produce any visible output. It used only as a container.

Q. - What are the event handlers that can be included in the Global.asax file?

Ans. - The Global.asax file contains some of the following important event handlers: Application_ErrorApplication_StartApplication_EndSession_StartSession_End

Q. - Explain CLR, CTS, CLS under .NET Framework?

Ans. - CLR also performs various other operations like Memory Management Application Execution Thread Management Security checks load the required assemblies and their types. The code which is managed by CLR is also known as Managed Code. All the managed languages are handled by a single runtime that is CLR. Common Type System (CTS) defines how the types are defined and used in the Common Language Runtime. CTS provides cross-language integration type safety and high-performance code execution.Common Language Specification (CLS) is a set of rules. CLS rules also define a subset of CTS. By defining components using CLS features only developers are guaranteed to make use of these components in all the other languages which are CLS compliant languages. Most of the types which are defined under .NET framework are CLS complaint.

Q. - What is the difference between page-level caching and fragment caching?

Ans. - In the page-level caching an entire Web page is cached; whereas in the fragment caching a part of the Web page such as a user control added to the Web page is cached.

Q. - How can you enable impersonation in the web.config file?

Ans. - To enable impersonation in the web.confing file you need to include the element in the web.config file and set the impersonate attribute to true as shown in the following code snippet: .

Q. - How can you identify that the page is PostBack?

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

Q. - Where should the data validations be performed-at the client side or at the server side and why?

Ans. - Data validations should be done primarily at the client side and the server-side validation should be avoided because it makes server task overloaded. If the client-side validation is not available you can use server-side validation. When a user sends a request to the server the validation controls are invoked to check the user input one by one.

Q. - What are the HTML server controls in ASP.NET?

Ans. - HTML server controls are similar to the standard HTML elements which are normally used in HTML pages. They expose properties and events that can be used programmatically. To make these controls programmatically accessible you need to specify that the HTML controls act as a server control by adding the runat="server" attribute.

Q. - What is the difference between HTML and Web server controls?

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

Q. - What is the difference between ASP session and ASP.NET session?

Ans. - ASP does not support cookie-less sessions; whereas ASP.NET does. In addition the ASP.NET session can span across multiple servers.

Q. - Which class is inherited when an ASP.NET server control is added to a Web form?

Ans. - The System.Web.UI.WebControls class is inherited when an ASP.NET server control is added to a Web form.

Q. - What are the Advantages and Disadvantages of Session?

Ans. - Following are the basic advantages and disadvantages of using session. Advantages: It stores user states and data to all over the application. Easy mechanism to implement and we can store any kind of object. Stores every user data separately. Session is secure and transparent from user because session object is stored on the server.Disadvantages: Performance overhead in case of large number of user because of session data stored in server memory. Overhead involved in serializing and De-Serializing session Data. Because In case of StateServer and SQLServer session mode we need to serialize the object before store.

Q. - Differentiate between namespace and assembly.

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

Q. - How do you change the session time-out value?

Ans. - 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. - What is delegate?

Ans. - 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. - What are the types of Authentication in ASP.NET?

Ans. - There are three types of authentication available in ASP.NET:Windows Authentication: This authentication method uses built-in windows security features to authenticate user.Forms Authentication: authenticate against a customized list of users or users in a database.Passport Authentication: validates against Microsoft Passport service which is basically a centralized authentication service.

Q. - What is managed code in .Net?

Ans. - 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. - Explain the difference between dataset and datareader.

Ans. - Dataset is a disconnected architecture whereas datareader is connected architecture.Dataset is the best choice when we need to access data from more than one table.Dataset is handy when we need to move back while reading records. Compare to datareader using dataset has an adverse affect on speed.

Q. - What is ASP.NET AJAX?

Ans. - ASP.NET AJAX mostly called AJAX is a set of extensions of ASP.NET. It is developed by Microsoft to implement AJAX functionalities in Web applications. ASP.NET AJAX provides a set of components that enable the developers to develop applications that can update only a specified portion of data without refreshing the entire page. The ASP.NET AJAX works with the AJAX Library that uses object-oriented programming (OOP) to develop rich Web applications that communicate with the server using asynchronous postback.

Q. - Why do we use the UpdateProgress control in AJAX?

Ans. - The UpdateProgress control is somewhat related to the UpdatePanel control. The UpdateProgress control enables you to design a user-friendly interface when a Web page consists of a number of UpdatePanel controls for partial-page rendering.

Q. - What is Script Manager?

Ans. - Script Manager helps manage the client side script of AJAX. Script Manager acts as a mediator as AJAX depends on JavaScript. Every page that uses AJAX has a Script Manager to enable AJAX libraries.

Q. - What is the Difference between session and caching?

Ans. - Session data is stored at the user level but caching data is stored at the application level and shared by all the users. It means that it is simply session data that will be different for the various users for all the various users session memory will be allocated differently on the server but for the caching only one memory will be allocated on the server and if one user modifies the data of the cache for all the user data will be modified.

Q. - What is the difference between Server.Transfer and Response.redirect?

Ans. - The Response.Redirect method redirects a request to a new URL and specifies the new URL while the Server.Transfer method for the current request terminates execution of the current page and starts execution of a new page using the specified URL path of the page.

Q. - What is the difference between constant and read only in c#?

Ans. - Constant is known as 'const' keyword in C# which is also known immutable values which are known at compile time and do not change their values at run time like in any function or constructor for the life of application till the application is running.Readonly is known as readonly keyword in C# which is also known immutable values and are known at compile and run time and do not change their values at run time like in any function for the life of application till the application is running.

Q. - What is the Constructor Chaining in C#?

Ans. - constructor chaining is a way to connect two or more classes in a relationship as Inheritance. In Constructor Chaining every child class constructor is mapped to parent class Constructor implicitly by base keyword so when you create an instance of child class it ll call parent's class Constructor .

Q. - What are Indexer in C# .Net?

Ans. - Indexer allows classes to be used in more intuitive manner. Indexers are used for treating an object as an array. The indexers are usually known as smart arrays in C#. An indexer also called an indexed property is a class property that allows to access a member variable of a class using the features of an array.Defining an indexer allows to create classes that act like virtual arrays. Instances of that class can be accessed using the [] array access operator.

Q. - What is jagged array in C#.Net?

Ans. - A jagged array is an array whose elements are arrays. The elements of a jagged array can be of different dimensions and sizes. A jagged array is sometimes called an "array of arrays."A Jagged Array is an array of an array in which the length of each array index can differ.

Q. - Explain use of Abstract and Sealed Classes in C#?

Ans. - The abstract keyword enables to create classes and class members that are incomplete and must be implemented in a derived class.The sealed keyword enables to prevent the inheritance of a class or certain class members that were previously marked virtual.

Q. - What is boxing?

Ans. - Boxing is the process of explicitly converting a value type into a corresponding reference type. Basically this involves creating a new object on the heap and placing the value there. Reversing the process is just as easy with unboxing which converts the value in an object reference on the heap into a corresponding value type on the stack.

Q. - What is Language Integrated Query (LINQ)?

Ans. - LINQ is a programming model that is the composition of general-purpose standard query operators that allow you to work with data regardless of the data source in any .NET based programming language. It is the name given to a set of technologies based on the integration of query capabilities into any .NET language.

Q. - In which statement the LINQ query is executed?

Ans. - A LINQ query is executed in the foreach statement in C#.

Q. - What is the difference between the Take and Skip clauses?

Ans. - The Take clause returns a specified number of elements. For example you can use the Take clause to return two values from an array of numbers. The Skip clause skips the specified number of elements in the query and returns the rest. For example you can use the Skip clause to skip the first four strings in an array of strings and return the remaining array of string.

Q. - What are the different implementations of LINQ?

Ans. - The different implementations of LINQ are: LINQ to SQL - Refers to a component of.NET Framework version 3.5 that provides a run-time infrastructure to manage relational data as objects. LINQ to DataSet - Refers to a component that makes it easier and faster to query over data cached in a DataSet object. LINQ to XML - Provides an in-memory XML programming interface.LINQ to Objects - Refers to the use of LINQ queries with any IEnumerable or IEnumerable(T) collection directly without the use of an intermediate LINQ provider or API such as LINQ to SQL or LINQ to XML.

Q. - What is JQuery?

Ans. - JQuery is a cross-browser lightweight JavaScript library. In simple words jQuery has been designed to make navigation to any element easier or adding/invoking event handlers on your HTML page and also simplify the way you access the elements in your web pages provide help in working with client-side events enable visual effects like animation and make it easier to use Ajax in your applications.

Q. - What is the difference between ID selector and class selector in jQuery?

Ans. - ID selector uses ID e.g. #element1 to select element while class selector uses CSS class to select elements. When you just need to select only one element use ID selector while if you want to select a group of element having same CSS class than use class selector.

Q. - What are the 2 important parts of a master page?

Ans. - The following are the 2 important parts of a master page: 1. The Master Page itself 2. One or more Content Pages.

Q. - How do you bind a Content Page to a Master Page?

Ans. - MasterPageFile attribute of a content page's @ Page directive is used to bind a Content Page to a Master Page.

Q. - What is $(document).ready() function in Jquery?

Ans. - The ready() function is used to execute code when document is ready for manipulation. jQuery allows you to execute code when DOM is fully loaded i.e. HTML has been parsed and the DOM tree has been constructed. The main benefit of $(document).ready() function is that it works in all browser jQuery handles cross browser difficulties for you.

Q. - What is ADO.NET ?

Ans. - ADO.Net is one of the major component of .Net Framework which is designed to connect to databases like Oracle MySQL SQL Server MS Access etc. and work with data stored in them.

Q. - What are the two fundamental objects in ADO.NET ?

Ans. - Fundamental Objects of ADO.Net are DataReader and DataSet. DataSet Object can have a set of DataTables and relationships between these tables. DataSet can be used in disconnected connection with DB. DataReader is used to read the read only data from a database.

Q. - What is the use of connection object ?

Ans. - Connection Objects is used to establish a connection between an application and databases like Oracle MySQl SQL Server etc. Once connection is established SQL Commands like insert update delete and select can be executed. Scope of a connection object can be local or global.

Q. - Explain the differences between managed and unmanaged code?

Ans. - Managed code is the code that is executed chatty by the QR Instead of the operating system. Unmanaged code is the code that is executed directly by the operating system outside the OR environment. In managed code since the execution of the code Is governed by CLR the runtime provides different services such as garbage collection type checking exception handling and safety and support These sat help provide uniformly in platform and language-Independent behavior of managed code applications. In unmanaged code the allocation of memory type safety and security is required to be taken are of by the developer. If the unmanaged code is not Properly handles may result In memory leak.

Q. - What is ASP.NET?

Ans. - ASP.NET is a specification developed by Microsoft to create dynamic Web applications Web sites and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages such as Visual Basic C# and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages such as VBScript. The Web Forms support to create powerful forms-based Web pages. You can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls you can easily create a Web application.