1.What is the basic difference between ASP and ASP.NET?

===>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).

 

2.How can we identify that the Page is Post Back?

===>Page object has an “IsPostBack” property, which can be checked to know that is the page posted back.

 

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

===>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 engineers
  • Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.

 

4.What is Query String? What are its advantages and limitations?

===>The Query String helps in sending the page information to the server.

The Query String has the following advantages:

Every browser works with Query Strings.

It does not require server resources and so does not exert any kind of burden on the server.

The following are the limitations of Query String:

Information must be within the limit because URL does not support many characters.

Information is clearly visible to the user, which leads to security threats.

 

5.Which ASP.NET objects encapsulate the state of the client and the browser?

===>The Session object encapsulates the state of the client and browser.

 

6.What are the events that happen when a client requests an ASP.NET page from IIS server?

===>  The following events happen when a client requests an ASP.NET page from the IIS server:

  1. User requests for an application resource.
  2. The integrated request-processing pipeline receives the first user request.
  3. Response objects are created for each user request.
  4. An object of the HttpApplication class is created and allocated to the Request object.
  5. The HttpApplication class processes the user request.

 

7.What is State Management in .Net and how many ways are there to maintain a state in .Net?

===>  In .net state management means request send by the client

can remember state of the previous request means

maintaining the state of the request.

The ways to maintain the state in asp.net are

server side state management like

1)session management

2)application

client side state management like

1)cookies

2)Hidden fields

 

8.To which class a Web form belongs to in the .NET Framework class hierarchy?

===>A Web form belongs to the System.Web.UI.Page class.

 

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

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

 

10.what is the function of custom validator control?

===>   The CustomValidator control allows you to create a validation control with customized validation logic. For example, you can create a validation control that checks whether the value entered into a text box is an even number.

 

11.What data types do the RangeValidator control support?

===>It supports

Currency

Date

Double

Integer

String

For comparing strings better to use Regularexpressionvalidator instead of Rangevalidator.

 

12.Explain validation control. How many validation contol in asp.net?

===>   There are five types of Validation Controls available in ASP.Net:

1) RequiredField Validation control:

It prompts message if any input field is left blank. This validation control can also be used to prompt message to the user if he or she has left any input field with its default value.

2) Range Validation control:

It prompts message to the user, if the data entered in the input field is not within the range of the values specified by the Maximum and Minimum properties of the validation control.

3) Comparison Validation control:

It allows the user to compare two values and check for comparisons such as equality, greater-than, less-than etc. In addition you can check whether the data entered in the input field is of the data type as specified by you.

4) RegularExpression Validation control:

It allows you to validate if the format of a certain input field is correct or not. You can check the validation of the commonly performed formats such as social security numbers, e-mail addresses, telephone numbers, and postal code.

5) Custom Validation control:

It allows you to define your own condition for validating the data in the input fields. Two validation functions can be performed using Custom Validation control: first on the server-side and second on the client-side. These functions contain logic defined by you to validate the input fields. These functions returns the True value and False value, if the condition you specified is correct or not respectively.

 

13.what is the use of global.asax file in asp.net?

===>   Global.asax is a special file, which is used to application wide initialization and any activities application wide. For example, if you would like to have a count of visitors to your site, you can easily do it, by having a application variable set in the Application_Start event (event available only in global.asax). You can increment the variable everytime in the Session_Start event (event available only in global.asax).

Ofcoz, this is an optional file, if you do not have any implementations like this or kind of this. Also, you don’t need special mechanism to include or do any changes to your existing application. Just put the global.asax file in the directory, and ASP.NET is intelligent enough to understand the presence of it and execute as needed.

The following are important events catered for in the Global.asax file:

  • Application_Init: Fires when the application initializes for the first time.
  • Application_Start: Fires the first time an application starts.
  • Session_Start: Fires the first time when a user’s session is started.
  • Application_BeginRequest: Fires each time a new request comes in.
  • Application_EndRequest: Fires when the request ends.
  • Application_AuthenticateRequest: Indicates that a request is ready to be authenticated.
  • Application_Error: Fires when an unhandled error occurs within the application.
  • Session_End: Fires whenever a single user Session ends or times out.
  • Application_End: Fires when the application ends or times out (Typically used for application cleanup logic).

14.what events are fired when page loads?

===>   Here is a list of ASP.Net page life cycle methods ordered in which they execute from pre initial state to the unload state of the web page:

  1. PreInit: occurs before initializing the page controls.
  2. Init: occurs after initializing the page controls along with applied skin settings.
  3. InitComplete: occurs at the end of initialization stage.
  4. PreLoad: occurs after loading the view state and postback data.
  5. Load: occurs after PreLoad event and thereafter it loads all the child controls. The Load eventof all the controls occurs after executing the load event of the page.
  6. Control Events: It represents the events associated to controls placed on the web page such asClick event of Button, CheckedChanged event of CheckBox etc.
  7. LoadComplete: occurs after completing the execution of event handlers.
  8. PreRender: occurs after creating all the controls required for rendering the page and thereafter it executes the PreRender event of all the child controls. The PreRender event of child controls occurs after executing the PreRender event of page.
  9. PreRenderComplete: occurs after the data bound controls specified with DataSourceIDvalues call their DataBind method.
  10. SaveState: occurs to save the control state and view state for the page.
  11. SaveStateComplete: occurs after saving the control state and view state for the page.
  12. Render: it initializes the HtmlTextWriter class object that writes the HTML markup and sends it to the browser.
  13. Unload: occurs when the memory is released by unloading the page controls. You cannot modify the output response stream inside its event handler.

 

15.What are Three Common Properties of all Validation controls in ASP.Net?

===>  1.Error message

2.Control to validate

3.Text

16.Difference between server side coding and client side coding?

===>  Server Side Code

Server side is the code that resides at web server.

For every client request code is executed at server side and result is send to the client in simple HTML format.

Performance is lower than client side code due to server round trips.

Client cannot see the business logic though it is stored on server.

Client Side Code

Client side code is reside at client’s browser itself. It is executed at client side only. User can easily see the code by View – > Source option.

It is generally used in validation form like text field is empty or not, email address validation etc. It is faster than server side code.

server side code is responsible to execute and provide the executed code to the browser at the client side. the executed code may be either in XML or Plain HTML. the executed code only have the values or the results that are executed on the server. The clients browser executes the HTML code and displays the result.

where as the client side code executes at client side and displays the result in its browser. it the client side core consist of certain functions that are to be executed on server then it places request to the server and the server responses as the result in form of HTML.

 

17.Data Bind Controls in ASP.NET?

===>  ASP.NET allows powerful feature of data binding, you can bind any server control to simple properties, collections, expressions and/or methods. When you use data binding, you have more flexibility when you use data from a database or other means.

Data Bind controls are container controls.

Controls -> Child Control

Data Binding is binding controls to data from databases. With data binding we can bind a control to a particular column in a table from the database or we can bind the whole table to the data grid.

Data binding provides simple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application.

Data binding allows you to take the results of properties, collection, method calls, and database queries and integrate them with your ASP.NET code. You can combine data binding with Web control rendering to relieve much of the programming burden surrounding Web control creation. You can also use data binding with ADO.NET and Web controls to populate control contents from SQL select statements or stored procedures.

Data binding uses a special syntax:

<%# %>

The <%#, which instructs ASP.NET to evaluate the expression. The difference between a data binding tags and a regular code insertion tags <% and %> becomes apparent when the expression is evaluated. Expressions within the data binding tags are evaluated only when the DataBind method in the Page objects or Web control is called.

Data Bind Control can display data in connected and disconnected model.

Following are data bind controls in ASP.NET:

  • Repeater Control
  • DataGrid Control
  • DataList Control
  • GridView Control
  • DetailsView
  • FormView
  • DropDownList
  • ListBox
  • RadioButtonList
  • CheckBoxList
  • BulletList
  • etc.

To display backend result set (tuple collection) Repeater Control, DataGrid Control, DataList Control, GridView Control are used.

Repeater Control, DataList Control and FormView Control are unformatted controls.

DetailsView and ForView controls display single tuple result at a time.

DropDownList, ListBox, RadioButtonList, CheckBoxList and BulletList controls displays single column values.

There are three types of binding:

  • Declarative Binding
  • Static Binding
  • Programmatically Binding

 

18.Explain ADO.Net Architecture?

ADO.Net Architecture in ASP.net Framework

Data Provider provides objects through which functionalities like opening and closing connection, retrieving and updating data can be availed.

It also provides access to data source like SQL Server, Access, and Oracle).

Some of the data provider objects are:

  • Command object which is used to store procedures.
  • Data Adapter which is a bridge between datastore and dataset.
  • Datareader which reads data from data store in forward only mode.
  • A dataset object is not in directly connected to any data store. It represents disconnected and cached data. The dataset communicates with Data adapter that fills up the dataset. Dataset can have one or more Datatable and relations.
  • DataView object is used to sort and filter data in Datatable.
Overview of ADO.NET architecture.

ADO.NET provides access to all kind of data sources such as Microsoft SQL Server, OLEDB, Oracle, XML.

ADO.NET separates out the data access and data manipulation componenets. ADO.NET includes some providers from the .NET Framework to connect to the database, to execute commands, and finally to retrieve results. Those results are either directly used or can be put in dataset and manipulate it.

Define connected and disconnected data access in ADO.NET

Data reader is based on the connected architecture for data access. Does not allow data manipulation

Dataset supports disconnected data access architecture. This gives better performance results.

Define connected and disconnected data access in ADO.NET

Data reader is based on the connected architecture for data access. Does not allow data manipulation

Dataset supports disconnected data access architecture. This gives better performance results.

Describe CommandType property of a SQLCommand in ADO.NET.

CommandType is a property of Command object which can be set to Text, Storedprocedure. If it is Text, the command executes the database query. When it is StoredProcedure, the command runs the stored procedure. A SqlCommand is an object that allows specifying what is to be performed in the database.

Access database at runtime using ADO.NET

SqlConnection sqlCon = new SqlConnection(connectionString)

sqlCon.Open();

string strQuery = “select CategoryName from abcd”;

SqlCommand cmd = new SqlCommand(strQuery, conn);

SqlDataReader reader = cmd.ExecuteReader();

while (reader.Read())

{

Console.WriteLine(reader

[0]);

}

reader.Close();

con.Close();