Monday 20 February 2017

ASP.NET interview questions Part-5

1. Ques: What are the new features in ASP.NET 4.5 ?
Answer:
Following are the new feature in asp.net 4.5
  • Bundling and Minification Feature
  • Strongly Typed Data Controls
  • Model Binding - Isolating the Web Form from the Model
  • Value Providers
  • Support for OpenID in OAuth Logins
  • Improved paging in ASP.NET 4.5 GridView control
  • Improved asynchronous programming.
  • Support for web sockets.
  • Support for HTML5 form types.
  • Page Inspector.
  • ASP.NET Web API
  • NET for Metro style Apps
  • Portable Class Libraries
  • Core New Features and Improvements
  • Parallel Computing.
  • Networking.
  • Support for Arrays Larger than 2 GB on 64-bit Platforms.
  • Enhanced Background Server Garbage Collection.
  • Support for Timeouts in Regular Expression Evaluations.
  • Support for Unicode 6.0.0 in Culture-Sensitive Sorting and Casing Rules on Windows 8.
  • Simple Default Culture Definition for an Application Domain.
  • Internationalized Domain Names in Windows 8 Apps.

2. Ques: What is the difference between user control and custom control?
Answer:
User Control:-

  • A tightly coupled control w.r.t code and UI
  • Derives from UserControl
  • Has static layout
  • It Can't be added to the toolbox.
  • Defines a set of controls.
  • Not very flexible like a Custom Control
  • It is useful static layout
  • Defines UI as normal XAML.
  • It can not compled into DLL.
  • Hard to Create.
  • A Seprate Copy of control required in each application.

Custom Control:-

  • A loosely coupled control w.r.t code and UI
  • Derives from Control
  • Has dynamic layout
  • It can be added in toolbox.
  • Defines a single control.
  • More flexible.
  • It is useful Dyanamic layout.
  • Defines UI in a ResourceDictionary.
  • It can compled into DLL.
  • Easy to Create.
  • A single Copy of control required in each application.


3. Ques: What is difference between server control and html control in asp.net ?
Answer: 
Server Controls:-
Server Controls are Server side controls and it executed on Server.
These controls Trigger Server side events.
Server Controls provides maintained State(view state) across requests.
It Provides set of properties that can be manipulated from server side code.
Server control inherits from System.Web.UI.

HTML Controls:
Html controls are client side controls and it executed on Browser.
These controls Trigger client side events.
HTML Controls can be maintained State using Page-level scripts.
It has the basic set of HTML attributes attached to each element.


4. Ques: What is Ispostback in asp.net and how to use it ?
Answer: 
IsPostBack is a property of the Asp.Net page that tells whether or not the page is on initial load.
using of the IsPostback Property we can check that page is Postback or not if page postback property is true then page is being post back if property is false then page is not postback.

Is Postback is normally used on page _load event to detect the Is page is getting loaded for the first time or not
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        // generate form;
    }
    else
    {
        //process submitted data;
    }
}

5. Ques: What's the difference between eval() and bind() in asp.net
Answer:
eval()
  • eval() is one way binding.
  • If you bind a value using Eval, it is like a read only. You can only view the data.
bind()
  • Bind() is two way binding.
  • If you bind a value using Bind and if you do some change on the value it will reflect on the database also

6. Ques:  What is difference between View State and Session State ?
Answer:
View State
  • View State is maintained the state in page level only.
  • View State of one page is not visible in another page.
  • It store information on client side.
  • View State persist the value of page in the client side(browser) when post back operation done.
  • View State used to persist the page specific data on the client side.
Session state
  • Session state is maintained the state in Session level.
  • Session state value is available in all page within a user session.
  • Session state information stored in server.
  • Session state persist the data of particular user in the server.This data available till user close the browser or session time complete.
  • Session state used to persist the user specific data on the server side

7. Ques:  What is Cross Page Posting in ASP.Net?
Answer:
Cross page postback is the concept which is used to submit one page (Default.aspx) controls to another page (Default2.aspx) and access those page (Default.aspx) control values in another page

Cross page posting is a new feature introduced in ASP.NET 2.0, which eases the life of developers previously they have to use Server.Transfer which has its own advantages and disadvantages but now this is a part of ASP.NET which results flexibility and efficiency.


8. Ques: How ViewState affect performance? What is the ideal size of a ViewState ? How can you compress a viewstate?
Answer:
Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.

Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream orDeflateStream to compress viewstate.


9. Ques:  What is protected configuration in asp.net ?
Answer:
ASP.NET 2.0 includes a protected configuration system for encrypting and decrypting configuration information. This includes methods in the .NET Framework that can be used to programmatically encrypt or decrypt configuration information.
   The sensitive information is stored in an ASP.NET application is the Web.config file. To help secure information in configuration files, ASP.NET provides a feature called protected configuration, which enables you to encrypt sensitive information in a configuration file. A configuration file that encrypts the connection string values using protected configuration does not show the connection strings in clear text, but instead stores them in encrypted form.

No comments:

Post a Comment

Thank you for comment