What are the Differences
between ASP.NET 3.5 and ASP.NET 4.0 | What are new features in Asp.net 4.0
Introduction
Here I will explain about differences between Asp.net 3.5 and
Asp.net 4.0.
Description
SNo
|
Feature
|
Asp.net 3.5
|
1.
|
New Features
|
Asp.net 3.5 includes the following new features
1) Listview Control
2) DataPager Control
3) Nested Master Pages
4) Linq DataSource
|
2.
|
Multi Targeting
|
Asp.net 3.5 supports multi –targeting What is multi –
targeting? Check below description
|
3.
|
Ajax Support
|
In Asp.net 3.5, Ajax is integrated in .NET framework, thereby
making the process of building intuitive cool user interfaces easier
|
4.
|
Silverlight Support
|
It support for silverlight
|
5.
|
JavaScript Debugging
|
It support for JavaScript debugging
|
6.
|
LINQ Support
|
It supports LINQ
|
Check below details for Asp.net
4.0 Features
In Asp.net 4.0 many new
features has included in the .NET Framework 4 in visual studio 2010.
The Web.config file that contains the configuration for a Web application
has grown considerably over the past few releases of the .NET Framework as new
features have been added, such as Ajax, routing, and integration with IIS 7.
This has made it harder to configure or start new Web applications without a
tool like Visual Studio. In .the NET Framework 4, the major configuration
elements have been moved to themachine.config file, and 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, which specify for Visual Studio what version
of the framework the application is targeting:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
</system.web>
</configuration
|
Extensible Output Caching
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.
Permanently Redirecting a Page
ASP.NET 4 adds a new RedirectPermanent helper method that makes it easy to issue HTTP 301 Moved Permanently responses, as in the following example:
RedirectPermanent("/newpath/foroldcontent.aspx");
Search engines and other user agents that recognize permanent redirects will store the new URL
Permanently Redirecting a Page
ASP.NET 4 adds a new RedirectPermanent helper method that makes it easy to issue HTTP 301 Moved Permanently responses, as in the following example:
RedirectPermanent("/newpath/foroldcontent.aspx");
Search engines and other user agents that recognize permanent redirects will store the new URL
that is associated with the content, which eliminates the
unnecessary round trip made by the
browser for temporary redirects.
ASP.NET 4 introduces a new compression option for both kinds of
out-of-process session-state providers. When the compressionEnabled configuration
option shown in the following example is set to true, ASP.NET will
compress (and decompress) serialized session state by using the .NET
FrameworkSystem.IO.Compression.GZipStream class.
<sessionState mode="SqlServer" sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate"allowCustomSqlDatabase="true" compressionEnabled="true"/>
|
Multi-Targeting
Asp.net 4 also supports Multi Targeting check this post for multi- targeting
The Visual Studio templates for both Web Forms and MVC include the
open-source jQuery library. When you create a new website or project, a Scripts
folder containing the following 3 files is created:
·
jQuery-1.4.1.js – The human-readable, unminified version of the
jQuery library.
·
jQuery-14.1.min.js – The minified version of the jQuery library.
·
jQuery-1.4.1-vsdoc.js – The Intellisense documentation file for
the jQuery library.
Include the unminified version of jQuery while developing an
application. Include the minified version of jQuery for production
applications.
For example, the following Web Forms page illustrates how you can use jQuery to change the background color of ASP.NET TextBox controls to yellow when they have focus.
For example, the following Web Forms page illustrates how you can use jQuery to change the background color of ASP.NET TextBox controls to yellow when they have focus.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Show jQuery</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtFirstName" runat="server" />
<br />
<asp:TextBox ID="txtLastName" runat="server" />
</div>
</form>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$("input").focus( function() { $(this).css("background-color", "yellow"); });
</script>
</body>
</html>
|
Content Delivery Network
Support
The Microsoft Ajax Content Delivery Network (CDN) enables you to
easily add ASP.NET Ajax and jQuery scripts to your Web applications. For
example, you can start using the jQuery library simply by adding a<script> tag
to your page that points to Ajax.microsoft.com like this:
<script
src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js"
type="text/javascript"></script>
In the past, if you used the ASP.NET ScriptManger then you were
required to load the entire monolithic ASP.NET Ajax Library. By taking
advantage of the new ScriptManager.AjaxFrameworkMode property, you can control
exactly which components of the ASP.NET Ajax Library are loaded and load only
the components of the ASP.NET Ajax Library that you need.
The ScriptManager.AjaxFrameworkMode property can be set to the following values:
The ScriptManager.AjaxFrameworkMode property can be set to the following values:
·
Enabled -- Specifies that the ScriptManager control automatically
includes the MicrosoftAjax.js script file, which is a combined script file of
every core framework script (legacy behavior).
·
Disabled -- Specifies that all Microsoft Ajax script features are
disabled and that the ScriptManager control does not reference any scripts
automatically.
·
Explicit -- Specifies that you will explicitly include script
references to individual framework core script file that your page requires,
and that you will include references to the dependencies that each script file
requires.
For example, if you set the AjaxFrameworkMode property to the
value Explicit then you can specify the particular ASP.NET Ajax component
scripts that you need:
<asp:ScriptManager ID="sm1" AjaxFrameworkMode="Explicit" runat="server">
<Scripts>
<asp:ScriptReference Name="MicrosoftAjaxCore.js" />
<asp:ScriptReference Name="MicrosoftAjaxComponentModel.js" />
<asp:ScriptReference Name="MicrosoftAjaxSerialization.js" />
<asp:ScriptReference Name="MicrosoftAjaxNetwork.js" />
</Scripts>
</asp:ScriptManager>
|
Web
Forms
Web Forms has been a core feature in ASP.NET since the release of
ASP.NET 1.0. Many enhancements have been in this area for ASP.NET 4, including
the following:
·
The ability to set meta tags.
·
More control over view state.
·
Easier ways to work with browser capabilities.
·
Support for using ASP.NET routing with Web Forms.
·
More control over generated IDs.
·
The ability to persist selected rows in data controls.
·
More control over rendered HTML in the FormView and ListView controls.
·
Filtering support for data source controls.
ASP.NET 4 adds two properties to the Page class, MetaKeywords and MetaDescription.
These two properties represent corresponding meta tags in your page,
as shown in the following example:
<head id="Head1" runat="server">
<title>Untitled Page</title>
<meta name="keywords" content="These, are,
my, keywords" />
<meta name="description" content="This is the
description of my page" />
</head>
|
By default, view state is enabled for the page, with the result
that each control on the page potentially stores view state even if it is not
required for the application. View state data is included in the markup that a
page generates and increases the amount of time it takes to send a page to the
client and post it back. Storing more view state than is necessary can cause
significant performance degradation. In earlier versions of ASP.NET, developers
could disable view state for individual controls in order to reduce page size,
but had to do so explicitly for individual controls. In ASP.NET 4, Web server
controls include aViewStateMode property that lets you disable view state
by default and then enable it only for the controls that require it in the
page.
In ASP.NET 4, browser definition files have been updated to
contain information about recently introduced browsers and devices such as
Google Chrome, Research in Motion BlackBerry smartphones, and Apple iPhone.
ASP.NET 4 adds built-in support for using routing with Web Forms.
Routing lets you configure an application to accept request URLs that do not
map to physical files. Instead, you can use routing to define URLs that are
meaningful to users and that can help with search-engine optimization (SEO) for
your application. For example, the URL for a page that displays product
categories in an existing application might look like the following example:
http://website/products.aspx?categoryid=12
By using routing, you can configure the application to accept the
following URL to render the same information:
http://website/products/software
The GridView and ListView controls can let
users select a row. In previous versions of ASP.NET, selection has been based
on the row index on the page. For example, if you select the third item on page
1 and then move to page 2, the third item on that page is selected.
Persisted selection was initially supported only in Dynamic Data projects in the .NET Framework 3.5 SP1. When this feature is enabled, the current selected item is based on the data key for the item. This means that if you select the third row on page 1 and move to page 2, nothing is selected on page 2. When you move back to page 1, the third row is still selected. Persisted selection is now supported for the GridViewand ListView controls in all projects by using the EnablePersistedSelection property, as shown in the following example:
Persisted selection was initially supported only in Dynamic Data projects in the .NET Framework 3.5 SP1. When this feature is enabled, the current selected item is based on the data key for the item. This means that if you select the third row on page 1 and move to page 2, nothing is selected on page 2. When you move back to page 1, the third row is still selected. Persisted selection is now supported for the GridViewand ListView controls in all projects by using the EnablePersistedSelection property, as shown in the following example:
<asp:GridView id="GridView2" runat="server" EnablePersistedSelection="true">
</asp:GridView>
|
ASP.NET Chart Control
The ASP.NET Chart control expands the data-visualization
offerings in the .NET Framework. Using theChart control, you can create
ASP.NET pages that have intuitive and visually compelling charts for complex
statistical or financial analysis. The ASP.NET Chart control was
introduced as an add-on to the .NET Framework version 3.5 SP1 release and is
part of the .NET Framework 4 release.
The control includes the following features:
The control includes the following features:
·
35 distinct chart types.
·
An unlimited number of chart areas, titles, legends, and
annotations.
·
A wide variety of appearance settings for all chart elements.
·
3-D support for most chart types.
·
Smart data labels that can automatically fit around data points.
·
Strip lines, scale breaks, and logarithmic scaling.
·
More than 50 financial and statistical formulas for data analysis
and transformation.
·
Simple binding and manipulation of chart data.
·
Support for common data formats such as dates, times, and
currency.
·
Support for interactivity and event-driven customization,
including client click events using Ajax.
·
State management.
·
Binary streaming.
The ListView control has been made easier to use in
ASP.NET 4. The earlier version of the control required that you specify a
layout template that contained a server control with a known ID. The following
markup shows a typical example of how to use the ListView control in
ASP.NET 3.5.
<asp:ListView ID="ListView1" runat="server">
<LayoutTemplate>
<asp:PlaceHolder ID="ItemPlaceHolder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<% Eval("LastName")%>
</ItemTemplate>
</asp:ListView>
|
In ASP.NET 4, the ListView control does not require a
layout template. The markup shown in the previous example can be replaced with
the following markup:
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<% Eval("LastName")%>
</ItemTemplate>
</asp:ListView>
|
Before ASP.NET 4, the Menu control rendered a series of
HTML tables. This made it more difficult to apply CSS styles outside of setting
inline properties and was also not compliant with accessibility standards.
In ASP.NET 4, the control now renders HTML using semantic markup that consists of an unordered list and list elements.
In ASP.NET 4, the control now renders HTML using semantic markup that consists of an unordered list and list elements.
The ASP.NET Wizard and CreateUserWizard controls
support templates that let you define the HTML that they render.
ASP.NET MVC
ASP.NET MVC was introduced as an add-on framework to ASP.NET 3.5 SP1 in March 2009. Visual Studio 2010 includes ASP.NET MVC 2, which includes new features and capabilities.
Dynamic Data
Dynamic Data was introduced in the .NET Framework 3.5 SP1 release in mid-2008. This feature provides many enhancements for creating data-driven applications, including the following:
ASP.NET MVC
ASP.NET MVC was introduced as an add-on framework to ASP.NET 3.5 SP1 in March 2009. Visual Studio 2010 includes ASP.NET MVC 2, which includes new features and capabilities.
Dynamic Data
Dynamic Data was introduced in the .NET Framework 3.5 SP1 release in mid-2008. This feature provides many enhancements for creating data-driven applications, including the following:
·
A RAD experience for quickly building a data-driven Web site.
·
Automatic validation that is based on constraints defined in the
data model.
·
The ability to easily change the markup that is generated for
fields in the GridView and DetailsViewcontrols by using field
templates that are part of your Dynamic Data project.
For ASP.NET 4, Dynamic Data has been enhanced to give developers
even more power for quickly building data-driven Web sites.
Dynamic Data features that shipped in the .NET Framework 3.5 SP1
brought new features such as the following:
·
Field templates – These provide data-type-based templates for
data-bound controls. Field templates provide a simpler way to customize the
look of data controls than using template fields for each field.
·
Validation – Dynamic Data lets you use attributes on data classes
to specify validation for common scenarios like required fields, range
checking, type checking, pattern matching using regular expressions, and custom
validation. Validation is enforced by the data controls.
Declarative DynamicDataManager
Control Syntax
The DynamicDataManager control has been enhanced so that
you can configure it declaratively, as with most controls in ASP.NET, instead
of only in code. The markup for the DynamicDataManager control looks
like the following example:
<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
<DataControls>
<asp:DataControlReference ControlID="GridView1" />
</DataControls>
</asp:DynamicDataManager>
<asp:GridView id="GridView1" runat="server"
</asp:GridView>
|
This markup enables Dynamic Data behavior for the GridView1 control that is referenced in theDataControls section of the DynamicDataManager control.
ASP.NET 4 introduces two new built-in field templates, EmailAddress.ascx and Url.ascx.
These templates are used for fields that are marked as EmailAddress or Url with
the DataType attribute. For EmailAddressobjects, the field is
displayed as a hyperlink that is created by using the mailto: protocol.
When users click the link, it opens the user's e-mail client and creates a
skeleton message. Objects typed as Url are displayed as ordinary
hyperlinks.
The following example shows how fields would be marked.
The following example shows how fields would be marked.
[DataType(DataType.EmailAddress)]
public object HomeEmail { get; set; }
[DataType(DataType.Url)]
public object Website { get; set; }
|
Dynamic Data uses the new routing feature that was added in the
.NET Framework 3.5 SP1 to control the URLs that end users see when they access
the Web site. The new DynamicHyperLink control makes it easy to build
links to pages in a Dynamic Data site. The following example shows how to use
theDynamicHyperLink control:
<asp:DynamicHyperLink ID="ListHyperLink" runat="server" Action="List" TableName="Products">
Show all products
</asp:DynamicHyperLink>
|
This markup creates a link that points to the List page for the Products table
based on routes that are defined in the Global.asax file.
The control automatically uses the default table name that the Dynamic Data
page is based on.
Both the Entity Framework and LINQ to SQL support inheritance in
their data models. An example of this might be a database that has an InsurancePolicy table.
It might also contain CarPolicy and HousePolicytables that have the same fields as InsurancePolicy and
then add more fields. Dynamic Data has been modified to understand inherited
objects in the data model and to support scaffolding for the inherited tables.
The Entity Framework has rich support for many-to-many
relationships between tables, which is implemented by exposing the relationship
as a collection on an Entity object. New ManyToMany.ascx andManyToMany_Edit.ascx field
templates have been added to provide support for displaying and editing data
that is involved in many-to-many relationships.
Web development in Visual Studio 2010 has been enhanced for
greater CSS compatibility, increased productivity through HTML and ASP.NET
markup snippets and new dynamic IntelliSense JavaScript.
The Visual Web Developer designer in Visual Studio 2010 has been
updated to improve CSS 2.1 standards compliance. The designer better preserves
integrity of the HTML source and is more robust than in previous versions of
Visual Studio.
Visual Studio 2010 includes over 200 snippets that help you
auto-complete common ASP.NET and HTML tags, including required attributes (such
as runat="server") and common attributes specific to a tag (such as ID, DataSourceID, ControlToValidate,
and Text).
In Visual 2010, JavaScript IntelliSense has been redesigned to
provide an even richer editing experience.
When ASP.NET developers deploy a Web application, they often find
that they encounter issues such as the following:
Web deployment features in Visual Studio 2010 include the following major areas:
Web deployment features in Visual Studio 2010 include the following major areas:
·
Web packaging
·
Web.config transformation
·
Database deployment
·
One-click publish for Web applications
The following sections provide details about these features.
Visual Studio 2010 uses the MSDeploy tool to create a compressed
(.zip) file for your application, which is referred to as a Web package.
The package file contains metadata about your application plus the following
content:
·
IIS settings, which includes application pool settings, error page
settings, and so on.
·
The actual Web content, which includes Web pages, user controls,
static content (images and HTML files), and so on.
·
SQL Server database schemas and data.
·
Security certificates, components to install in the GAC, registry
settings, and so on.
For Web application deployment, Visual Studio 2010 introduces XML
Document Transform (XDT), which is a feature that lets you transform a Web.config file
from development settings to production settings. Transformation settings are
specified in transform files named web.debug.config, web.release.config,
and so on.
The following example shows a portion of a web.release.config file that might be produced for deployment of your release configuration. The Replace keyword in the example specifies that during deployment theconnectionString node in the Web.config file will be replaced with the values that are listed in the example.
The following example shows a portion of a web.release.config file that might be produced for deployment of your release configuration. The Replace keyword in the example specifies that during deployment theconnectionString node in the Web.config file will be replaced with the values that are listed in the example.
<connectionStrings xdt:Transform="Replace">
<add name="BlogDB" connectionString="connection string detail]" />
</connectionStrings>
|
A Visual Studio 2010 deployment package can include dependencies
on SQL Server databases. As part of the package definition, you provide the
connection string for your source database. When you create the Web package,
Visual Studio 2010 creates SQL scripts for the database schema and optionally
for the data, and then adds these to the package.
Visual Studio 2010 also lets you use the IIS remote management
service to publish a Web application to a remote server.
No comments:
Post a Comment