· 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="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js" >
·
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
Then specify the newly created and configured custom cache provider as below:
1. HandleProcessCorruptedStateExceptionsAttribute Class
- Enables managed code to handle exceptions that indicate a corrupted process state.So,If you want to compile an application in the .NET Framework 4 and handle corrupted state exceptions, you can apply this attribute to the method that handles the corrupted state exception.
2.FirstChanceExceptionEventArgs Class -
Provides data for the notification event that is raised when a managed exception first occurs, before the common language runtime begins searching for event handlers.
What is machine.config file and how do you use it in ASP.Net
4.0?
Machine.Config file is found in the "CONFIG" subfolder of your .NET Framework install directory (c:\WINNT\Microsoft.NET\Framework\{Version Number}\CONFIG on Windows 2000 installations). It contains configuration settings for machine-wide assembly binding, built-in remoting channels, and ASP.NET.
In .the NET Framework 4.0, the major configuration elements(that use to be in web.config) have been moved to the machine.config file, and the applications now inherit these settings. This allows the Web.config file in ASP.NET 4 applications either to be empty or to contain just the following lines.
Machine.Config file is found in the "CONFIG" subfolder of your .NET Framework install directory (c:\WINNT\Microsoft.NET\Framework\{Version Number}\CONFIG on Windows 2000 installations). It contains configuration settings for machine-wide assembly binding, built-in remoting channels, and ASP.NET.
In .the NET Framework 4.0, the major configuration elements(that use to be in web.config) have been moved to the machine.config file, and the applications now inherit these settings. This allows the Web.config file in ASP.NET 4 applications either to be empty or to contain just the following lines.
What is RedirectPermanent in ASP.Net 4.0?
In earlier Versions of .Net, Response.Redirect was used, which issues an HTTP 302 Found or temporary redirect response to the browser (meaning that asked resource is temporarily moved to other location) which inturn results in an extra HTTP round trip. ASP.NET 4.0 however, adds a new RedirectPermanent that Performs a permanent redirection from the requested URL to the specified URL. and returns 301 Moved Permanently responses.
e.g. RedirectPermanent("/newpath/foroldcontent.aspx");
In earlier Versions of .Net, Response.Redirect was used, which issues an HTTP 302 Found or temporary redirect response to the browser (meaning that asked resource is temporarily moved to other location) which inturn results in an extra HTTP round trip. ASP.NET 4.0 however, adds a new RedirectPermanent that Performs a permanent redirection from the requested URL to the specified URL. and returns 301 Moved Permanently responses.
e.g. RedirectPermanent("/newpath/foroldcontent.aspx");
How will you specify what version of the framework your
application is targeting?
In Asp.Net 4 a new element "targetFramework" of compilation tag (in Web.config file) lets you specify the framework version in the webconfig file as
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
</configuration>
It only lets you the .NET Framework 4.0 and later verisons.
In Asp.Net 4 a new element "targetFramework" of compilation tag (in Web.config file) lets you specify the framework version in the webconfig file as
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
</configuration>
It only lets you the .NET Framework 4.0 and later verisons.
What is Microsoft Ajax Library?
Microsoft Ajax Library is a client-only JavaScript library that is compatible with all modern browsers, including Internet Explorer, Google Chrome, Apple Safari, and Mozilla Firefox.Because the Microsoft Ajax Library is a client-only JavaScript library, you can use the library with both ASP.NET Web Forms and ASP.NET MVC applications. You can also create Ajax pages that consist only of HTML.
Microsoft Ajax Library is a client-only JavaScript library that is compatible with all modern browsers, including Internet Explorer, Google Chrome, Apple Safari, and Mozilla Firefox.Because the Microsoft Ajax Library is a client-only JavaScript library, you can use the library with both ASP.NET Web Forms and ASP.NET MVC applications. You can also create Ajax pages that consist only of HTML.
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.
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.
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:
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:
<caching>
<outputCache
defaultProvider="AspNetInternalProvider">
<providers>
<add
name="DiskCache"
type="Test.OutputCacheEx.DiskOutputCacheProvider,
DiskCacheProvider"/>
</providers>
</outputCache>
</caching>
Then specify the newly created and configured custom cache provider as below:
<%@ OutputCache
Duration="60" VaryByParam="None"
providerName="DiskCache" %>
What is permanent redirecting and how do you implement it?
ASP.Net 4.0 introduced a new URL redirection method RedirectPermanent() which avoids round trips.
You can implement this as shown below:
ASP.Net 4.0 introduced a new URL redirection method RedirectPermanent() which avoids round trips.
You can implement this as shown below:
RedirectPermanent("/newpath/newpage.aspx");
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.
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]"
/>
</asp:PlaceHolder>
</asp:PlaceHolder>
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.
In ASP.Net 4.0 we can specify how to generate control ids using 'ClientIDMode' attribute instead of generating dynamically like container_controlidXXX.
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:
AutoID
This is equivalent to the algorithm for generating ClientID property values that was used in earlier versions of ASP.NET.
Static
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.
Predictable
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.
Inherit
This setting is the default behavior for controls; it specifies that a control's ID generation is the same as its parent.
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:
AutoID
This is equivalent to the algorithm for generating ClientID property values that was used in earlier versions of ASP.NET.
Static
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.
Predictable
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.
Inherit
This setting is the default behavior for controls; it specifies that a control's ID generation is the same as its parent.
What is QueryExtender Control?
QueryExtender Control is an add-on to the DataSource Controls: EntityDataSource and LinqDataSource. QueryExtender is used to filter the data returned by these controls. As the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations.
E.g.:
QueryExtender Control is an add-on to the DataSource Controls: EntityDataSource and LinqDataSource. QueryExtender is used to filter the data returned by these controls. As the QueryExtender control relies on LINQ, the filter is applied on the database server before the data is sent to the page, which results in very efficient operations.
E.g.:
<asp:LinqDataSource ID="dataSource" runat="server">
TableName="Products">
</asp:LinqDataSource>
<asp:QueryExtender TargetControlID="dataSource"
runat="server">
<asp:SearchExpression
DataFields="ProductName, Supplier.CompanyName"
SearchType="StartsWith">
<asp:ControlParameter ControlID="TextBoxSearch" />
</asp:SearchExpression>
</asp:QueryExtender>
How would you Deploy your old applications with .Net Framework
4.0? Are the Old applications compatible?
.NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions. Though Some Changes have been made to improve security, standards compliance, correctness, reliability, and performance.
To run older applications with .NET Framework 4, you will have to re-compile your applications with the target .NET Framework version specified in the properties for your project in Visual Studio Or you can specify the supported runtime with the <supportedruntime> Element in an application configuration file. .Net Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework.
.NET Framework 4 is highly compatible with applications that are built with earlier .NET Framework versions. Though Some Changes have been made to improve security, standards compliance, correctness, reliability, and performance.
To run older applications with .NET Framework 4, you will have to re-compile your applications with the target .NET Framework version specified in the properties for your project in Visual Studio Or you can specify the supported runtime with the <supportedruntime> Element in an application configuration file. .Net Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework.
Whts is Parallel Computing?
To take advantage of multiple cores (that is, CPUs or processors) you can parallelize your code so that it will be distributed across multiple processors. In the past, parallelization required low-level manipulation of threads and locks, but Visual Studio 2010 and the .NET Framework 4 enhances the support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. These features simplify parallel development so that you can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.
The new System.Threading.Tasks namespace and other related types support this new model.
To take advantage of multiple cores (that is, CPUs or processors) you can parallelize your code so that it will be distributed across multiple processors. In the past, parallelization required low-level manipulation of threads and locks, but Visual Studio 2010 and the .NET Framework 4 enhances the support for parallel programming by providing a new runtime, new class library types, and new diagnostic tools. These features simplify parallel development so that you can write efficient, fine-grained, and scalable parallel code in a natural idiom without having to work directly with threads or the thread pool.
The new System.Threading.Tasks namespace and other related types support this new model.
What is BigInteger and When would you use that?
BigInteger, which is a part of System.Numerics Namespace is a great enhancement over Byte and Int32 datatypes. It is a nonprimitive integral type that supports arbitrarily large signed integers. Unlike Byte and Int32 types, BigInteger does not include a Minvalue and MaxValue property, so can be used to store large integer values.
BigInteger, which is a part of System.Numerics Namespace is a great enhancement over Byte and Int32 datatypes. It is a nonprimitive integral type that supports arbitrarily large signed integers. Unlike Byte and Int32 types, BigInteger does not include a Minvalue and MaxValue property, so can be used to store large integer values.
What other than BigInteger has been introduced in
System.Numerics Namespace?
Complex types,which represents a complex number has been Introduced. a complex number is a number in the form a + bi, where a is the real part, and b is the imaginary part.
Complex types,which represents a complex number has been Introduced. a complex number is a number in the form a + bi, where a is the real part, and b is the imaginary part.
How do you assign a Value to a Complex Number?
You can assign a value to a complex number in few different ways.
1. By passing two Double values to its constructor. The first value represents the real part of the complex number, and the second value represents its imaginary part.
2. By assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object. The value becomes the real part of the complex number, and its imaginary part equals 0.
E.g Complex c1 = new Complex(12, 6);
Console.WriteLine(c1);
OutPut - (12, 6)
You can assign a value to a complex number in few different ways.
1. By passing two Double values to its constructor. The first value represents the real part of the complex number, and the second value represents its imaginary part.
2. By assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object. The value becomes the real part of the complex number, and its imaginary part equals 0.
E.g Complex c1 = new Complex(12, 6);
Console.WriteLine(c1);
OutPut - (12, 6)
How has exception hand changed in .Net Framework 4.0?
A New Namespace System.Runtime.ExceptionServices has been introduced which provides classes for advanced exception handling. It has introduced the following classes
A New Namespace System.Runtime.ExceptionServices has been introduced which provides classes for advanced exception handling. It has introduced the following classes
1. HandleProcessCorruptedStateExceptionsAttribute Class
- Enables managed code to handle exceptions that indicate a corrupted process state.So,If you want to compile an application in the .NET Framework 4 and handle corrupted state exceptions, you can apply this attribute to the method that handles the corrupted state exception.
2.FirstChanceExceptionEventArgs Class -
Provides data for the notification event that is raised when a managed exception first occurs, before the common language runtime begins searching for event handlers.
How to use COM components in Visual Studio .NET with Visual C# .NET or
in Visual Studio 2005 with Visual C# 2005
This step-by-step
article describes how to use a COM component from in Microsoft Visual Studio
.NET by using Microsoft Visual C# .NET or in Microsoft Visual Studio 2005 by
using Microsoft Visual C# 2005.
No comments:
Post a Comment