.NET Interview Questions and Answers -12

.NET Interview Questions and Answers -12

1. What is new with ASP.Net 4 WebForms ?

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.

2. What is machine.config file and how do you use it in ASP.Net 4.0?

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.

3. What is RedirectPermanent in ASP.Net 4.0?

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");

4. How will you specify what version of the framework your application is targeting?

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>

5. What is the use of MetaKeywords and MetaDescription properties.

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" %>

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

7. What are the Changes in CheckBoxList and RadioButtonList Control ?

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

8. Whats Application Warm-Up Module?

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.

9. What are the Major Improvements in .Net Framework 4.0?

Ans. Introduced in .Net Framework 4.0

10. How would you Deploy your old applications with .Net Framework 4.0? Are the Old applications compatible?

.NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions. Though Some Changes have been made to improve security, standards compliance, correctness, reliability, and performance.

To run older applications with .NET Framework 4, you will have to re-compile your applications with the target .NET Framework version specified in the properties for your project in Visual Studio Or you can specify the supported runtime with the Element in an application configuration file. .Net Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework.

11. Whts is Parallel Computing?

To take advantage of multiple cores (that is, CPUs or processors) you can parallelize your code so that it will be distributed across multiple processors. In the past, parallelization required low-level manipulation of threads and locks, but Visual Studio 2010 and the .NET Framework 4 enhances the support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. These features simplify parallel development so that you can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.

The new System.Threading.Tasks namespace and other related types support this new model.

12. What is BigInteger and When would you use that?

BigInteger, which is a part of System.Numerics Namespace is a great enhancement over Byte and Int32 datatypes. It is a nonprimitive integral type that supports arbitrarily large signed integers. Unlike Byte and Int32 types, BigInteger does not include a Minvalue and MaxValue property, so can be used to store large integer values.

13. What other than BigInteger has been introduced in System.Numerics Namespace?

Complex types,which represents a complex number has been Introduced. a complex number is a number in the form a + bi, where a is the real part, and b is the imaginary part.

14. How do you assign a Value to a Complex Number.

You can assign a value to a complex number in few different ways.
1. By passing two Double values to its constructor. The first value represents the real part of the complex number, and the second value represents its imaginary part.
2. By assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object. The value becomes the real part of the complex number, and its imaginary part equals 0.

E.g Complex c1 = new Complex(12, 6);
Console.WriteLine(c1);
OutPut - (12, 6)

15. How has exception hand changed in .Net Framework 4.0

A New Namespace System.Runtime.ExceptionServices has been introduced which provides classes for advanced exception handling. It has introduced the following classes
1. HandleProcessCorruptedStateExceptionsAttribute Class - Enables managed code to handle exceptions that indicate a corrupted process state.So,If you want to compile an application in the .NET Framework 4 and handle corrupted state exceptions, you can apply this attribute to the method that handles the corrupted state exception.
2.FirstChanceExceptionEventArgs Class -Provides data for the notification event that is raised when a managed exception first occurs, before the common language runtime begins searching for event handlers.

16. What are the major improvements provided by the common language runtime and the base class libraries?

Brief about the Improvements -

Diagnostics and Performance - Starting with the .NET Framework 4, you can get processor usage and memory usage estimates per application domain.
Garbage Collection - This feature replaces concurrent garbage collection in previous versions and provides better performance.
Code Contracts - Code contracts let you specify contractual information that is not represented by a method's or type's signature alone. The new System.Diagnostics.Contracts namespace contains classes that provide a language-neutral way to express coding assumptions in the form of preconditions, postconditions, and object invariants.
Design-Time-Only Interop Assemblies - You no longer have to ship primary interop assemblies (PIAs) to deploy applications that interoperate with COM objects. In the .NET Framework 4, compilers can embed type information from interop assemblies, selecting only the types that an application (for example, an add-in) actually uses.
Dynamic Language Runtime - The dynamic language runtime (DLR) is a new runtime environment that adds a set of services for dynamic languages to the CLR. The DLR makes it easier to develop dynamic languages to run on the .NET Framework and to add dynamic features to statically typed languages. To support the DLR, the new System.Dynamic namespace is added to the .NET Framework.
Covariance and Contravariance - Several generic interfaces and delegates now support covariance and contravariance.
BigInteger and Complex Numbers - The new System.Numerics.BigInteger structure is an integer data type that can store fairly large number as it has no upper and lower bound values.Complex types represents a complex number of form a + bi. IT supports arithmetic and trigonometric operations with complex numbers.
Tuples - The .NET Framework 4 provides the System..::.Tuple class for creating tuple objects that contain structured data.
System Enumeration Improvements - You can now enumerate directories and files by using methods that return an enumerable collection of strings of their names.ou can also use methods that return an enumerable collection of DirectoryInfo, FileInfo, or FileSystemInfo objects.
Memory-Mapped Files - A memory-mapped file contains the contents of a file in virtual memory and is an application’s logical address space. So You can use memory-mapped files to edit very large files and to create shared memory for interprocess communication.
64-Bit Operating Systems and Processes - You can identify 64-bit operating systems and processes with the Environment.Is64BitOperatingSystem and Environment.Is64BitProcess properties.

17. What is .NET 4.0?

It is latest version of DotNet framework offered by microsoft to develop software applications.

18. What is .NET framework 4.0

.NET is a new framework produced by microsoft for developing and running software applications which includes web,desktop and mobile applications. It supports veriety of programming languages like C#,VB,C++,Java etc

19. What are the new features of .NET 3.5?

Main new features of .NET 3.5 are :
a)VS 2008 Multi-Targeting Support
b)In Built AJAX support for ASP.NET
c)LINQ Support
d)JavaScript Debugging Support
e)Nested Master Page Support
f)LINQ Intellisense and Javascript Intellisense support
g)Organize Imports or Usings support
h)Intellisense Filtering support
i)Visual Studio 2008 Split View
j)Debugging .NET Framework Library Source Code support

20. What is LINQ?

LINQ stands for language integrated query.

21. What is the advantages of using LINQ?

Advantage of using LINQ is that we can write SQL queries in programming languages like C# or VB and we can check errors in queries at compile time.

22. What is meant by VS 2008 Multi-Targeting Support?

It means that we can create application for .NET 1.1 , .NET 2.0 and .NET 3.5 using VS 2008

23. What is Visual Studio 2008 Split View?

Visual Studio 2008 Split View provides the option to see both source and design views by splitting the screen.

24. What is javascript debugging support in Visual Studio 2008?

In Visual Studio 2008 you can put the break point in javascript code and debug like any other language

25. What is meant by In Built AJAX support for ASP.NET?

It is not required to download ASP.NET Ajax Framework 1.0 as with .NET framework 2.0.It is in built now.

26. What is Entity Data Model?

Entity data model is a new way to handle data as entity. It is supported by Visual Studio 2008 SP1

27.What is partitioning in SQL Server?

Partitioning is one of the new functionality in SQL Server 2005. Partitioning enables you to split the table across the multiple storage units called file groups based on user specification.

28.What are the advantages of partitioning?

Partition allows you to place subset table or index on designated file group.
Partition helps to us segregate the data within table based on age, gender etc
This gives advantage to take a back up of subset of table based on specific category.

29.What are the different steps to partition table or index?

Create a partition function.
Create partition scheme mapped to a partition function.
Create the table or index on the partition scheme.

30.What is Partition function?

Partition function is a database object that defines the boundary points to the partitioning the data.
Partition function will be first step to create partitioned table, index and view.

31.What is the syntax to create partition function?

CREATE PARTITION FUNCTION partition_function_name ( input_parameter_type )
AS RANGE [ LEFT | RIGHT ]
FOR VALUES ( [ boundary_value [ ,...n ] ] ) [ ; ]

32.What is partition scheme?

Partition scheme defines file groups, which will be used with specific partition function.
Partition scheme will be second step to create partitioned table, index and view.

33.What are the requirements to create partition scheme?

Partition function would required to create partition scheme
Files groups mentioned in partition scheme must already be part of the database.
File groups must not be marked as read only.

34.What are the steps to partition a non partitioned or existing table?

Create a partition function.
Create a partition scheme.
Drop the existing clustered index.
Recreate the clustered index on the partition scheme.

35.What is Microsoft ADO.NET?

ADO.NET is one of the component in the Microsoft.NET framework which contains following features to Windows, web and distributed applications.

i. Data Access to the applications from Database in connected (Data reader object) and disconnected (Data set and data table) model.
ii. Modify the data in database from application.

36.What are the Benefits of ADO.Net?

ADO.Net offers following Benefits
Interoperability:XML Format is one of the best formats for Interoperability.ADO.NET supports to transmit the data using XML format.
Scalability:ADO.NET works on Dataset that can represent a whole database or even a data table as a disconnected object and thereby eliminates the problem of the constraints of number of databases being connected. In this way scalability is achieved.
Performance:The performance in ADO.NET is higher in comparison to ADO that uses COM marshalling.
Programmability:ADO.Net Data components in Visual studio help to do easy program to connect to the database.

37.Explain different connection objects used in ADO.NET?

Sqlconnection object used to connect to a Microsoft SQL Server database. SQL database connections use the SqlDataAdapter object to perform commands and return data.
OracleConnection object used to connect to Oracle databases. Oracle database connections use the OracleDataAdapter object to perform commands and return data. This connection object was introduced in Microsoft .NET Framework version 1.1.
OleDbConnection object used to connect to a Microsoft Access or third-party database, such as MySQL. OLE database connections use the OleDbDataAdapter object to perform commands and return data.

38.What are the different steps to access a database through ADO.NET?

Create a connection to the database using a connection object.
Open the Database Connection.
Invoke a command to create a Dataset object using an adapter object.
Use the Dataset object in code to display data or to change items in the database.
Invoke a command to update the database from the Dataset object using an adapter object.
Close the database connection.

39.What is the difference between Data Reader and Data Adapter?

Data Reader is read only forward only and much faster than Data Adapter.
If you use Data Reader you have to open and close connection explicitly where as if you use Data Adapter the connection is automatically opened and closed.
Data Reader  expects connection to database to perform any operation on data where as Data Adapter is disconnected

40.What is the difference between Execute Reader, Execute Scalar and Execute Non Query methods?

Execute Reader:Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object.

Execute Scalar:Execute Scalar will be used to return the single value, on execution of SQL Query or Stored procedure using command object.

Execute Non Query:If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use Execute Non Query method. Execute Non Query method returns an integer specifying the number of rows inserted, deleted or updated.

41.What is the .NET Framework?

The .NET Framework is a set of technologies that form an integral part of the .NET Platform. It is Microsoft’s managed code programming model for building applications.
The .NET Framework has two main components:
Common Language Runtime (CLR):The CLR is one of the foundation in the .NET framework and provides a common set of services for applications developed on Microsoft .Net Technologies.
.NET Framework class library:The .NET framework class library is a collection of reusable types and exposes features of the runtime. It contains of a set of classes that is used to access common functionality.

42.What is CTS (Common Type System)?

The common type system (CTS) defines how types are declared, used, and managed in the runtime, and is also an important part of the runtime’s support for cross-language integration. The common type system performs the following functions:
Establishes a framework that helps to enable cross-language integration, type safety, and high performance code execution.
Define the rules that languages must follow, which helps to ensure that objects written in different languages can interact with each other.

43.What is CLS (Common Language Specification)?

This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow, so that it can communicate with other .NET languages in a seamless manner.

44.What is .Net Assembly?

.Net Assembly is one basic building of application. It can be an .exe or .dll file.
.Net Assembly can be used to Simplify application deployment
Solves the versioning problems that can occur with component-based applications.

45.What are the Different elements in .Net Assembly?

Assembly manifest
Type Metadata
MSIL Code
Set of Resources

46.What is Global Assembly catche?

If the machine installs with .NetFramework, then the machine contains a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the machine/computer.

47.What are different ways to deploy an assembly in to global assembly catche?

We can use the Global Assembly Cache tool (Gacutil.exe), GAC Tool has provided by the .NET Framework SDK.
We can use Windows Explorer to drag assemblies into the cache.
We can use an installer designed to work with the global assembly cache.

48.Explain the Application Domain in .NetFramework?

Application Domain will isolate applications that are running on same computer. Application domains will provide more secure and versatile unit of processing that CLR can use to provide isolation between applications.

49.What are the benefits of isolation provided by the Application domains?

Faults in one application cannot affect other applications. The application domains ensure that code running in one domain cannot affect other applications in the process.
Individual applications can be stopped without stopping the entire process. Application domains will enable you to unload the code running in a single application.

50. Explain the DataAdapter.Update() and DataSetAcceptChanges() methods.

The DataAdapter.Update() method calls any of the DML statements, such as the UPDATE, INSERT, or DELETEstatements, as the case may be to update, insert, or delete a row in a DataSet. TheDataSet.Acceptchanges() method reflects all the changes made to the row since the last time theAcceptChanges() method was called.

51. What is the meaning of object pooling?

Object pooling is a concept of storing a pool (group) of objects in memory that can be reused later as needed. Whenever, a new object is required to create, an object from the pool can be allocated for this request; thereby, minimizing the object creation. A pool can also refer to a group of connections and threads. Pooling, therefore, helps in minimizing the use of system resources, improves system scalability, and performance.

52. What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?

You must set the DataSource property and call the DataBind() method.

53. Mention the namespace that is used to include .NET Data Provider for SQL server in .NET code.

The System.Data.SqlClient namespace.

54. What is the difference between OLEDB Provider and SqlClient?

With respect to usage, there is no difference between OLEDB Provider and SqlClient. The difference lies in their performance. SqlClient is explicitly used to connect your application to SQL server directly, OLEDB Provider is generic for various databases, such as Oracle and Access including SQL Server.

Therefore, there will be an overhead which leads to performance degradation.

55. Name the two properties of the GridView control that have to be specified to turn on sorting and paging.

The properties of the GridView control that need to be specified to turn on sorting and paging are as follows:

    The AllowSorting property of the Gridview control indicates whether sorting is enabled or not. You should set the AllowSorting property to True to enable sorting.
    The AllowPaging property of the Gridview control indicates whether paging is enabled or not. You should set the AllowPaging property to True to enable paging.

56. Mention different types of data providers available in .NET Framework.

    .NET Framework Data Provider for SQL Server – Provides access to Microsoft SQL Server 7.0 or later version. It uses the System.Data.SqlClient namespace.
    .NET Framework Data Provider for OLE DB – Provides access to databases exposed by using OLE DB. It uses the System.Data.OleDb namespace.
    .NET Framework Data Provider for ODBC – Provides access to databases exposed by using ODBC. It uses the System.Data.Odbc namespace.
    .NET Framework Data Provider for Oracle – Provides access to Oracle database 8.1.7 or later versions. It uses the System.Data.OracleClient namespace.

57. Which architecture does Datasets follow?

Datasets follow the disconnected data architecture.

58. What is a DataReader object?

The DataReader object helps in retrieving the data from a database in a forward-only, read-only mode. The base class for all the DataReader objects is the DbDataReader class.
The DataReader object is returned as a result of calling the ExecuteReader() method of the Command object. The DataReader object enables faster retrieval of data from databases and enhances the performance of .NET applications by providing rapid data access speed. However, it is less preferred as compared to theDataAdapter object because the DataReader object needs an Open connection till it completes reading all the rows of the specified table.
An Open connection to read data from large tables consumes most of the system resources. When multiple client applications simultaneously access a database by using the DataReader object, the performance of data retrieval and other related processes is substantially reduced. In such a case, the database might refuse connections to other .NET applications until other clients free the resources.

59. How can you identify whether or not any changes are made to the DataSet object since it was last loaded?

The DataSet object provides the following two methods to track down the changes:

The GetChanges() method – Returns the DataSet object, which is changed since it was loaded or since the AcceptChanges() method was executed.
The HasChanges() method – Indicates if any changes occurred since the DataSet object was loaded or after a call to the AcceptChanges() method was made.

60. Which property is used to check whether a DataReader is closed or opened?

The IsClosed property is used to check whether a DataReader is closed or opened. This property returns atrue value if a Data Reader is closed, otherwise a false value is returned.

61. Name the method that needs to be invoked on the DataAdapter control to fill the generated DataSet with data?

The Fill() method is used to fill the dataset with data.

62. What is the use of the Connection object?

The Connection object is used to connect your application to a specific data source by providing the required authentication information in connection string. The connection object is used according to the type of the data source. For example, the OleDbConnection object is used with an OLE-DB provider and the SqlConnectionobject is used with an MS SQL Server.

63. What is the use of the CommandBuilder class?

The CommandBuilder class is used to automatically update a database according to the changes made in aDataSet.This class automatically registers itself as an event listener to the RowUpdating event. Whenever data inside a row changes, the object of the CommandBuilder class automatically generates an SQL statement and uses theSelectCommand property to commit the changes made in DataSet.
OLEDB provider in .NET Framework has the OleDbCommandBuiider class; whereas, the SQL provider has theSqlCommandBuilder class.

65. Describe the disconnected architecture of ADO.NET’s data access model.

ADO.NET maintains a disconnected database access model, which means, the application never remains connected constantly to the data source. Any changes and operations done on the data are saved in a local copy (dataset) that acts as a data source. Whenever, the connection to the server is re-established, these changes are sent back to the server, in which these changes are saved in the actual database or data source.

66. What are the pre-requisites for connection pooling?

The prerequisites for connection pooling are as follows:

There must be multiple processes to share the same connection describing the same parameters and security settings.
The connection string must be identical.

67. What are the various methods provided by the DataSet object to generate XML?

The various methods provided by the DataSet object to generate XML are:
ReadXml() - Reads XML document into a DataSet object.
GetXml() - Returns a string containing an XML document.
WriteXml() - Writes an XML data to disk.

68. Out of Windows authentication and SQL Server authentication, which authentication technique is considered as a trusted authentication method?

The Windows authentication technique is considered as a trusted authentication method because the username and password are checked with the Windows credentials stored in the Active Directory.

The SQL Server Authentication technique is not trusted as all the values are verified by SQL Server only.

69. How would you connect to a database by using .NET?

The connection class is used to connect a .NET application with a database.

70. Which adapter should you use, if you want to get the data from an Access database?

OleDbDataAdapter is used to get the data from an Access database.

71. Which object is used to add a relationship between two DataTable objects?

The DataRelation object is used to add relationship between two DataTable objects.

72. What are different types of authentication techniques that are used in connection strings to connect .NET applications with Microsoft SQL Server?

.NET applications can use two different techniques to authenticate and connect with SQL Server. These techniques are as follows:

The Windows Authentication option
The SQL Server Authentication option

73. Explain the new features in ADO.NET Entity Framework 4.0.

ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and includes the following new features:

Persistence Ignorance - Facilitates you to define your own Plain Old CLR Objects (POCO) which are independent of any specific persistence technology.
Deferred or Lazy Loading - Specifies that related entities can be loaded automatically whenever required. You can enable lazy loading in your application by setting the DeferredLoadingEnabledproperty to true.
Self-Tracking Entities - Refers to the entities that are able to track their own changes. These changes can be passed across process boundaries and saved to the database.
Model-First Development - Allows you to create your own EDM and then generate relational model (database) from that EDM with matching tables and relations.
Built-in Functions - Enables you to use built-in SQL Server functions directly in your queries.
Model-Defined Functions - Enables you to use the functions that are defined in conceptual schema definition language (CSDL).

74. What are the parameters that control most of connection pooling behaviors?

The parameters that control most of connection pooling behaviors are as follows:

Connect Timeout
Max Pool Size
Min Pool Size
Pooling

75. How can you add or remove rows from the DataTable object of DataSet?

The DataRowCollection class defines the collection of rows for the DataTable object in a DataSet. TheDataTable class provides the NewRow() method to add a new DataRow to DataTable. The NewRow method creates a new row, which implements the same schema as applied to the DataTable. The following are the methods provided by the DataRowCollection object:

76. Explain in brief DataAdapter class in ADO.NET.

The DataAdapter class retrieves data from the database, stores data in a dataset, and reflects the changes made in the dataset to the database. The DataAdapter class acts as an intermediary for all the communication between the database and the DataSet object. The DataAdapter Class is used to fill a DataTable or DataSetObject with data from the database using the Fill() method. The DataAdapter class applies the changes made in dataset to the database by calling the Update() method.
The DataAdapter class provides four properties that represent the database command:SelectCommand, InsertCommand, DeleteCommand, and UpdateCommand..

77.When during the page processing cycle is ViewState available?
  
After the Init() and before the Page_Load(), or OnLoad() for a control.

78. What namespace does the Web page belong in the .NET Framework class hierarchy?
 
System.Web.UI.Page

79.Where do you store the information about the user’s locale?
  
System.Web.UI.Page.Culture

80. What’s a bubbled event?
  
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.
          
81.What data types do the RangeValidator control support?
  
Integer, String, and Date.

82.What is the difference between Server.Transfer and Response.Redirect? Why would I choose  one over the other? 
  
Server.Transfer transfers page processing from one page directly to the next 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. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a 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.

83. What base class do all Web Forms inherit from?
 
The Page class.

84. What is ViewState?
 
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.

85.What does the "EnableViewState" property do? Why would I want it on or off?
 
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.     

86.How to manage state in Asp.Net Web applications?

State management is done at client side and server side
Client Side: Client Side it can achieved with the help of View state, Cookies, Query String,hidden fields    and control state.
Server Side: with the help of Cache, Application,Session and Database.

87. What is smart navigation? 
          
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.

88. What is System.Web.Mail?
  
System.Web.Mail (SWM) is the .Net namespace used to send email in .Net Framework applications.  SWM contains three classes:

1. MailMessage - used for creating and manipulating the mail message contents.
2. MailAttachments - used for creating a mail attachment to be added to the mail message.
3. SmtpMail - used for sending email to the relay mail server.

89. How many objects does ADO.Net have and what are they?
 
There are 5 objects in ADO.Net.
They are Connection, Adapter, Command, Reader and Dataset.
  
90.  How does ASP.Net page works?
  
1. When a browser requests an HTML file, the server returns the file
2. When a browser requests an ASP.Net file, IIS passes the request to the ASP.Net engine on the server.
3. The ASP.Net engine reads the file, line by line, and executes the scripts in the file
4. Finally, the ASP.Net file is returned to the browser as plain HTML.

91.How do you debug an ASP.Net Web application?
    
Attach the aspnet_wp.exe process to the DbgClr debugger.

92.In order to get assembly info which namespace we should have import?
   
System.Reflection Namespace

93.How can you detect if a viewstate has been tampered?

By setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.

94.Can I use different programming languages in the same application?

Yes. Each page can be written with a different programming language in the same application. You can create a few pages in C# and a few in VB.NET.

95.Can the App_Code folder contain source code files in different programming languages?

No. All source code files kept in the root App_Code folder must be in the same programming language.

Update: However, you can create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders.  You also have to add configuration settings in the web.config for this to work.

96.How do you secure your connection string information?

By using the Protected Configuration feature.

97.How do you secure your configuration files to be accessed remotely by unauthorized users?

ASP.NET configures IIS to deny access to any user that requests access to the Machine.config or Web.config files.

98.How can I configure ASP.NET applications that are running on a remote machine?

You can use the Web Site Administration Tool to configure remote websites.

99.How many web.config files can I have in an application?

You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
By setting the element's Override attribute to false.

100.What is the difference between Response.Write and Response.Output.Write?

As quoted by Scott Hanselman, the short answer is that the latter gives you String.Format-style output and the former doesn't.

101.What is Cross Page Posting? How is it done?

By default, ASP.NET submits a form to the same page. In cross-page posting, the form is submitted to a different page. This is done by setting the ‘PostBackUrl’ property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the ‘FindControl’ method of the ‘PreviousPage’ property to reference the data of the control in the first page.

102.Can you change a Master Page dynamically at runtime? How?

Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.

103.What happens when you change the web.config file at run time?

ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.

104.Can you programmatically access IIS configuration settings?

Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.

0 comments:

Post a Comment