Interview Questions on ASP.Net 4.0 Features

By: DoYouKnow.IN | Views: 3359 | Date: 17-Aug-2011

This section provides all possible ASP.Net 4.0 interview questions collected from various people from their experiences and various resources. Please always make sure to refer good books to find best answers and accuracy.

1 . What is new in Asp.Net

ASP.Net 4.0 has many improvements from previous versions such as

  •     Web.config File Refactoring
  •     Extensible Output Caching
  •     Auto-Start Web Applications
  •     Permanently Redirecting a Page by introducing a new method RedirectPermanent()
  •     Shrinking Session State to shrink session data
  •     Extensible Request Validation to avoid cross-site scripting (XSS) attacks by adding custom request-validation logic.
  •     Object Caching and Object Caching Extensibility by introducing a new assembly "System.Runtime.Caching.dll"

ASP.Net 4.0 also introduced many new features such as

  •     jQuery Included with Web Forms and MVC: Built in JQuery support
  •     Content Delivery Network Support: Enables you to easily add ASP.NET Ajax and jQuery scripts to your Web applications. We can refence JQuery script over http like <script src="" >
  •     New Meta tags under HTML Head tag
  •     Enabling View State for Individual Controls
  •     Extended Browser Capabilities
  •     ASP.NET Chart Control to create visually compelling charts for complex statistical or financial analysis
  •     New Field Templates for URLs and E-mail Addresses
2. How is Caching extended in asp.Net 4.0?

OutPut Cache in earlier versions of ASP.Net has a limitation - generated content always has to be stored in memory, and on servers that are experiencing heavy traffic, the memory consumed by output caching can compete with memory demands from other portions of a Web application.

ASP.NET 4 adds an extensibility point to output caching that enables you to configure one or more custom output-cache providers. Output-cache providers can use any storage mechanism to persist HTML content. This makes it possible to create custom output-cache providers for diverse persistence mechanisms, which can include local or remote disks, cloud storage, and distributed cache engines.

3. What is permanent redirecting and how do you implement it?

ASP.NET 4.0 introduces some SEO improvements. Response has now new method called RedirectPermanent(). This method performs same redirect as Response.Redirect() but it uses response code 301. You can find more information about HTTP response codes from HTTP 1.1 specification, chapter 10. Status Code Definitions.

Response.Redirect() returns 302 to browser meaning that asked resource is temporarily moved to other location. Permanent redirect means that browser gets 301 as response from server. In this case browser doesn’t ask the same resource from old URL anymore – it uses URL given by Location header.

4. How do you implement custom output caching?

Create a custom output-cache provider as a class that derives from the new System.Web.Caching.OutputCacheProvider type. You can then configure the provider in the Web.config file by using the new providers subsection of the outputCache element, as shown below:

                  <outputCache defaultProvider="AspNetInternalProvider">
                      <add name="DiskCache"
                          type="Test.OutputCacheEx.DiskOutputCacheProvider, DiskCacheProvider"/>

Then specify the newly created and configured custom cache provider as below:

<%@ OutputCache Duration="60" VaryByParam="None" providerName="DiskCache" %>

5. How do you implement ViewState for a control?

In ASP.NET 4, Web server controls include a ViewStateMode property that lets you disable view state by default and then enable it only for the controls that require it in the page.
The ViewStateMode property takes an enumeration that has three values: Enabled, Disabled, and Inherit. Enabled enables view state for that control and for any child controls that are set to Inherit or that have nothing set. Disabled disables view state, and Inherit specifies that the control uses the ViewStateMode setting from the parent control.

  <asp:PlaceHolder ID="PlaceHolder1" runat="server" ViewStateMode="Disabled">
      Disabled: <asp:Label ID="label1" runat="server" Text="[DeclaredValue]" /><br />
    <asp:PlaceHolder ID="PlaceHolder2" runat="server" ViewStateMode="Enabled">
        Enabled: <asp:Label ID="label2" runat="server" Text="[DeclaredValue]" />

6. How will the IDs for controls be managed in ASP.Net 4.0?

In ASP.Net 4.0 we can specify how to generate control ids using 'ClientIDMode' attribute instead of generating dynamically like container_controlidXXX.

7. What are the different ClientIDModes we can set and how will they work?

The new ClientIDMode property lets you specify more precisely how the client ID is generated for controls. You can set the ClientIDMode property for any control, including for the page. Possible settings are the following:

This is equivalent to the algorithm for generating ClientID property values that was used in earlier versions of ASP.NET.

This specifies that the ClientID value will be the same as the ID without concatenating the IDs of parent naming containers. This can be useful in Web user controls. Because a Web user control can be located on different pages and in different container controls, it can be difficult to write client script for controls that use the AutoID algorithm because you cannot predict what the ID values will be.

This option is primarily for use in data controls that use repeating templates. It concatenates the ID properties of the control's naming containers, but generated ClientID values do not contain strings like "ctlxxx". This setting works in conjunction with the ClientIDRowSuffix property of the control. You set the ClientIDRowSuffix property to the name of a data field, and the value of that field is used as the suffix for the generated ClientID value. Typically you would use the primary key of a data record as the ClientIDRowSuffix value.

This setting is the default behavior for controls; it specifies that a control's ID generation is the same as its parent.

Previous Page Next Page

People Searching On This Page:
  • mail loc:IN
  • email loc:IN
  • any limitation of clientidmode property in usercontrol in
  • dotnet 4.0 interview questions
  • 4 test.outputcacheex.diskoutputcacheprovider dll
  • interview questions in asp net
  • asp .net new features
  • set properties in 4.0
  • asp net cache usercontrol OutputCacheProvider how get key
  • .net 4.0 features and interview questions
  • dot net 4.0 interview questions
  • new features in 4.0 interview ponts
  • New Field Templates for URLs and Email Addresses in dotnet 4.0

Related Pages

New Cheques from 01 Jan 2012 -  Banks to introduce new CTS-2010

New Cheques from 01 Jan 2012 - Banks to introduce new CTS-2010

Articles | Finance | Banking
05-Dec-2012  Views: 1630

Banks to introduce new CTS-2010 by December 31, 2012. Banks all over India are in the process of issuing fresh-look cheques with more security and sta ...
Design a Mascot for Income Tax Department, win Rs 1,00,000!

Design a Mascot for Income Tax Department, win Rs 1,00,000!

Articles | Art & Entertainment | Visual Art
08-Sep-2012  Views: 2553

The Income Tax Department invites all artists and designers, both professionals and amateurs, to develop a Mascot to be used in all advertising and co ...
ASP.NET 4.0 Features - What is New ?

ASP.NET 4.0 Features - What is New ?

Articles | Programming | ASP.NET
12-Aug-2011  Views: 2652

ASP.NET v4 is released with Visual studio 2010. Web developers are presented with a bewildering range of new features and so Ludmal De Silva has descr ...
ASP.NET Interview Questions And Answers

ASP.NET Interview Questions And Answers

Articles | Programming | ASP.NET
25-Mar-2011  Views: 3148

Collection of ASP.NET 3.5 Interview Questions & Answers which are being asked in most interview. ...
Interview Questions for ASP.NET Part - 1

Interview Questions for ASP.NET Part - 1

Articles | Programming | ASP.NET
28-Aug-2010  Views: 2388

You can read more than 60 ASP.NET Interview Questions. ...
Post Your Comments (No Login Require)
Name : (required)
Email : (required)
Website :

Comment : (required)

5  + 4 =     
People Searched About:
Mail Timas.Net Loc:IN   |   Email Timas.Net Loc:IN   |   Any Limitation Of Clientidmode Property In Usercontrol In Asp.Net   |   Dotnet 4.0 Interview Questions   |   Asp.Net 4 Test.Outputcacheex.Diskoutputcacheprovider Dll   |   Interview Questions In Asp Net   |   Asp .Net New Features   |   Set Properties In Asp.Net 4.0   |   Asp Net Cache Usercontrol Outputcacheprovider How Get Key   |   .Net 4.0 Features And Interview Questions   |  
Google : 474 times | Yahoo : 42 times | Bing : 349 times |