Asp.Net Interview Answers


Entity Framework
Entity Framework (EF) is an object-relational mapper that enables .NET developers to work with relational data using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write.

PostBack
PostBack is the name given to the process of submitting an ASP.NET page to the server for processing. PostBack is done if certain credentials of the page are to be checked against some sources (such as verification of username and password using database). This is something that a client machine is not able to accomplish and thus these details have to be 'posted back' to the server.

Web services
The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Used primarily as a means for businesses to communicate with each other and with clients, Web services allow organizations to communicate data without intimate knowledge of each other's IT systems behind the firewall.
Unlike traditional client/server models, such as a Web server/Web page system, Web services do not provide the user with a GUI. Web services instead share business logic, data and processes through a programmatic interface across a network. The applications interface, not the users. Developers can then add the Web service to a GUI (such as a Web page or an executable program) to offer specific functionality to users.

API (application program interface):
API (application program interface) is a set of routines, protocols, and tools for building software applications. The API specifies how software components should interact and APIs are used when programming graphical user interface (GUI) components. A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.

View State in asp.net:
When a form is submitted in classic ASP, all form values are cleared. Suppose you have submitted a form with a lot of information and the server comes back with an error. You will have to go back to the form and correct the information. You click the back button, and what happens.......ALL form values are CLEARED, and you will have to start all over again! The site did not maintain your ViewState.
When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. How come? This is because ASP .NET maintains your ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control. The source could look something like this:
Data Objects That Can be stored in View state
  1. ·         String
  2. ·         Boolean Value
  3. ·         Array Object
  4. ·         Array List Object
  5. ·         Hash Table
  6. ·         Custom type Converters
  7. ·         Advantages of View State



Easy to Implement.
No server resources are required: The View State is contained in a structure within the page load.
Enhanced security features: It can be encoded and compressed or Unicode implementation.
Disadvantages of View State

Security Risk:
The Information of View State can be seen in the page output source directly. You can manually encrypt and decrypt the contents of a Hidden Field, but It requires extra coding. If security is a concern then consider using a Server-Based state Mechanism so that no sensitive information is sent to the client.

Performance:
Performance is not good if we use a large amount of data because View State is stored in the page itself and storing a large value can cause the page to be slow.

Device limitation:
Mobile Devices might not have the memory capacity to store a large amount of View State data.
  • ·         It can store values for the same page only.


When We Should Use View State
  • ·         When the data to be stored is small.
  • ·         Try to avoid secure data.



What is ASP.net?

ASP.NET is the next generation web application framework developed and marketed by Microsoft based on .NET Framework. But not to be confused that it's not an upgraded version of ASP. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successful successor to Microsoft's Active Server Pages (ASP) technology.

ASP.NET allow programmers to build dynamic web sites, web applications, web services and so many strong features. One of the key features of ASP.NET is that it uses an event-based programming model.

It is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET languages. It is a server side scripting technology that enables scripts (embedded in web pages) to be executed by a web server (Internet Information Services).In ASP.NET, you are not limited to scripting languages. You can now use the following .NET languages:

  • ·         C#
  • ·         J#
  • ·         VB.NET


Using Visual Studio, the development tool from Microsoft, web developers can develop very compelling applications using ASP.NET, with the ease of drag-and-drop server controls. Latest version finally announced by Microsoft. By adopting agile practices, and using IDE and ALM tools, Microsoft have been able to complete the release in half as many milestones this time around. Developing great apps for Windows 8 is an important goal of this release.

Please briefly explain ASP.NET Page life Cycle?

ASP.NET page passes through a series of steps during its life cycle. Following is the high-level explanation of life cycle stages/steps.
In order to memorize whole page life cycle process of Asp.net, keep store this word "SILVER" in your memory, which is defined as
S = Start
I = Initialization
L = Load
V = Validate
E = Event Handlers
R = Render

Initialization: Controls raise their Init event in this stage.Objects and variables are initializes for complete lifecyle of request.
LoadViewState: is a post back stage and loads the view state for the controls that enabled its view state property.
LoadPostBackData: is also a post back stage and loads the data posted for the controls and update them.
Load: In this stage page as well as all the controls raise their Load event. Till this stage all the controls are initialized and loaded. In most of the cases, we are coding this event handler.

RaisePostBackEvent: is again a postback stage. For example, it's raise against a button click event. We can easily put our code here to perform certain actions.
SaveViewState: Finally, controls state is saved in this stage before Rendering HTML.
Render: This is the stage where HTML is generated for the page.
Dispose: Lastly, all objects associated with the request are cleaned up.



Comments

Popular posts from this blog

Difference b/t Asp and Asp.net

C# Interview Answers

Interview Related Key Points