Question 1 – What is ASP.NET?

Answer: ASP.NET is Microsoft’s framework to build Web applications. ASP.NET is a part of .NET Framework. ASP.NET and Web Forms are used to build the front end and in the backend, C# langauge is used. ASP.NET runs on a Web Server, IIS.

Advantages of ASP.NET
Separation of Code from HTML

To make a clean sweep, with ASP.NET you have the ability to completely separate layout and business logic. This makes it much easier for teams of programmers and designers to collaborate efficiently.

Support for compiled languages

Developers can use VB.NET and access features such as strong typing and object-oriented programming. Using compiled languages also means that ASP.NET pages do not suffer the performance penalties associated with interpreted code. ASP.NET pages are precompiled to byte-code and Just In Time (JIT) compiled when first requested. Subsequent requests are directed to the fully compiled code, which is cached until the source changes.

Use services provided by the .NET Framework

The .NET Framework provides class libraries that can be used by your application. Some of the key classes help you with input/output, access to operating system services, data access, or even debugging. We will go into more detail on some of them in this module.

Graphical Development Environment

Visual Studio .NET provides a very rich development environment for web developers. You can drag and drop controls and set properties the way you do in Visual Basic 6. And you have full IntelliSense support, not only for your code but also for HTML and XML.

State management

To refer to the problems mentioned before, ASP.NET provides solutions for session and application state management. State information can, for example, be kept in memory or stored in a database. It can be shared across web farms, and state information can be recovered, even if the server fails or the connection breaks down.

Update files while the server is running

Components of your application can be updated while the server is online and clients are connected. The framework will use the new files as soon as they are copied to the application. Removed or old files that are still in use are kept in memory until the clients have finished.

XML-Based Configuration Files

Configuration settings in ASP.NET are stored in XML files that you can easily read and edit. You can also easily copy these to another server, along with the other files that comprise your application.

ASP.NET Overview
Here are some points that give a quick overview of ASP.NET.

ASP.NET provides services to allow the creation, deployment, and execution of Web Applications and Web Services.
Like ASP, ASP.NET is a server-side technology.
Web Applications are built using Web Forms. ASP.NET comes with built-in Web Forms controls, which are responsible for generating the user interface. They mirror typical HTML widgets like text boxes or buttons. If these controls do not fit your needs, you are free to create your own user controls.
Web Forms are designed to make building web-based applications as easy as building Visual Basic applications.

Question 2 – What are the different validators in ASP.NET?

Answer: ASP.NET validation controls define an important role in validating the user input data. Whenever the user gives the input, it must always be validated before sending it across to various layers of an application. If we get the user input with validation, then chances are that we are sending the wrong data. So, validation is a good idea to do whenever we are taking input from the user. There are the following two types of validation in ASP.NET,

Client-Side Validation
Server-Side Validation

Client-Side Validation

When validation is done on the client browser, then it is known as Client-Side Validation. We use JavaScript to do the Client-Side Validation.

Server-Side Validation

Server-Side Validation When validation occurs on the server, then it is known as Server-Side Validation. Server-Side Validation is a secure form of validation. The main advantage of Server-Side Validation is if the user somehow bypasses the Client-Side Validation, we can still catch the problem on server-side. The following are the Validation Controls in ASP.NET,When validation occurs on the server, then it is known as Server-Side Validation. Server-Side Validation is a secure form of validation. The main advantage of Server-Side Validation is if the user somehow bypasses the Client-Side Validation, we can still catch the problem on server-side. The following are the Validation Controls in ASP.NET,

  • RequiredFieldValidator Control
  • CompareValidator Control
  • RangeValidator Control
  • RegularExpressionValidator Control
  • CustomFieldValidator Control
  • ValidationSummary

For further information click on the link,

Validation Controls in ASP.Net

Question 3 – What is View State?

Answer: View State is the method to preserve the Value of the Page and Controls between round trips. It is a Page-Level State Management technique. View State is turned on by default and normally serializes the data in every control on the page regardless of whether it is actually used during a post-back.

A web application is stateless. That means that a new instance of a page is created every time when we make a request to the server to get the page and after the round trip our page has been lost immediately

Features of View State These are the main features of view state,

  1. Retains the value of the Control after post-back without using a session.
  2. Stores the value of Pages and Control Properties defined in the page.
  3. Creates a custom View State Provider that lets you store View State Information in a SQL Server Database or in another data store.

Advantages of View State

  1. Easy to Implement.
  2. No server resources are required: The View State is contained in a structure within the page load.
  3. Enhanced security features: It can be encoded and compressed or Unicode implementation.
Question 4: What are the different Session state management options available in ASP.NET?

Answer: State Management in ASP.NET

A new instance of the Web page class is created each time the page is posted to the server.
In traditional Web programming, all information that is associated with the page, along with the controls on the page, would be lost with each roundtrip.
The Microsoft ASP.NET framework includes several options to help you preserve data on both a per-page basis and an application-wide basis. These options can be broadly divided into the following two categories,

  1. Client-Side State Management Options
  2. Server-Side State Management Options

Client-Side State Management

Client-based options involve storing information either in the page or on the client computer.
Some client-based state management options are,

  • Hidden fields
  • View state
  • Cookies
  • Query strings

Server-Side State Management

There are situations where you need to store the state information on the server side.
Server-side state management enables you to manage application-related and session-related information on the server.

ASP.NET provides the following options to manage state at the server side:

  • Application state
  • Session state

For further information click on the link,

State Management in ASP.Net

Question 5 – What is Ajax in ASP.NET?

Answer. Ajax stands for Asynchronous JavaScript and XML; in other words Ajax is the combination of various technologies such as a JavaScript, CSS, XHTML, DOM, etc. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the entire page. We can also define Ajax is a combination of client-side technologies that provides asynchronous communication between the user interface and the web server so that partial page rendering occurs instead of a complete page postback. Ajax is platform-independent; in other words, AJAX is a cross-platform technology that can be used on any Operating System since it is based on XML & JavaScript. It also supports open source implementation of other technology. It partially renders the page to the server instead of the complete page being post back. We use AJAX for developing faster, better and more interactive web applications. AJAX uses an https request between web server & browser.

  • With AJAX, when a user clicks a button, you can use JavaScript and DHTML to immediately update the UI, and spawn an asynchronous request to the server to fetch results.
  • When the response is generated, you can then use JavaScript and CSS to update your UI accordingly without refreshing the entire page. While this is happening, the form on the user’s screen doesn’t flash, blink, disappear, or stall.
  • The power of AJAX lies in its ability to communicate with the server asynchronously, using a XMLhttpsRequest object without requiring a browser refresh.
  • Ajax essentially puts JavaScript technology and the XMLhttpsRequest object between your Web form and the server.
Question 6 – What is the difference between ASP.NET Web API and WCF?

Answer: The ASP. NET Web API is a framework that uses the https services and makes it easy to provide the response to the client request. The response depends on the request of the clients. The Web API builds the https services, and handles the request using the https protocols. The request may be GET, POST, DELETE, PUT. We can also say that the ASP. NET Web API:

  • Is an https service.
  • Is designed for reaching the broad range of clients.
  • Uses the https application.

 

 We use the ASP. NET Web API for creating the REST ful (Representational State Transfer) services. The following are some important points of the ASP. NET Web API,

  • The ASP. NET Web API supports the MVC application features that are controller, media formatters, routing etcetera.
  • It is a platform for creating the REST services.
    It is a framework for creating the https services.
  • Responses can be formatted by the APIs MediaTypeFormatter into the Java Script Object Notation (JSON) and Extencible Markup Language (XML) formats.
Question 7 – What is the PostBack property in ASP.NET?

Answer: If we create a web Page, which consists of one or more Web Controls that are configured to use AutoPostBack (every Web controls will have their own AutoPostBack property), the ASP.NET adds a special JavaScipt function to the rendered HTML Page. This function is named _doPostBack() . When Called, it triggers a PostBack, sending data back to the web Server. ASP.NET also adds two additional hidden input fields that are used to pass information back to the server. This information consists of ID of the Control that raised the event and any additional information if needed. These fields will empty initially as shown below,

<input type=hidden name=__EVENTTARGET id=__EVENTTARGET value= /> <input type=hidden name=__EVENTARGUMENT id=__EVENTARGUMENT value= />

The following actions will be taken place when a user changes a control that has the AutoPostBack property set to true: 

  1. On the client side, the JavaScript _doPostBack function is invoked, and the page is resubmitted to the server.
  2. ASP.NET re-creates the Page object using the .aspx file.
  3. ASP.NET retrieves state information from the hidden view state field and updates the controls accordingly.
  4. The Page.Load event is fired.
  5. The appropriate change event is fired for the control. (If more than one control has been changed, the order of change events is undetermined.)
  6. The Page.PreRender event fires, and the page is rendered (transformed from a set of objects to an HTML page).
  7. Finally, the Page.Unload event is fired.
  8. The new page is sent to the client.