What's new in ASP.NET 4.0 ? - DotNetSpider

bubblemessengerΑσφάλεια

5 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

99 εμφανίσεις

What’s new in ASP.NET 4.0 ?

Agenda


Changes to Core Services


Extensible Output Caching


Shrinking Session State


Performance Monitoring


Permanently redirecting a page



Changes to Web forms


Better control of the
viewstate


Setting
MetaTags


Chart
conrol


Routing


Setting Client IDs



Web Config File Refractoring


Auto
-
Start Web Applications


Expanding the Range of Allowable
URLs


Extensible Request Validation


Object Caching and Object Caching
Extensibility


Extensible HTML, URL, and HTTP Header
Encoding


Dynamic
Lookup


Covariance and
Contravariance


Variance in C# 4.0




Extensible Output Caching



Possibility of creation of own storage:


o
Memory

o
Local or Remote Drive

o
Cloud Services

o
Distributed
C
ache Engines



To configure the custom cache provider, specify the details in
your application's

Web.config file


<configuration>


<system.web>


<compilation debug="true" targetFramework="4.0"/>


<caching>


<outputCache

defaultProvider=“AspNetInternalProvide">


<providers>


<add name="CacheProviderName"


type="CacheProviderCategory"/>


</providers>


</outputCache>


</caching>


</system.web>

</configuration>


Possibility of creation of Cache Providers :

<%@

OutputCache

Duration="60"

VaryByParam="None"

pro
viderName
="CacheProviderName "

%>



Usage of Different cache providers for different pages:


public

override

string

GetOutputCacheProviderName(
HttpCo
ntext

context)

{




if

(context.Request.Path.EndsWith
(“example.aspx"))








return

"

CacheProviderName
";




else








return

base.GetOutputCacheProviderName(context);

}


Shrinking Session State

In ASP.NET we can compress session
state data
for both Session
-
state server and Microsoft SQL
server.

<sessionState



mode="SQLServer"

sqlConnecti
onString="data
source=local Initial
Catalog=
TestDB

allowCustomSqlDatabase
="true"

compressionE
nabled="true"/>


Performance Monitoring

If multiple applications use a single shared
worker process , it is difficult for server
administrators to identify an individual
application performance.


In IIS hosted ASP.NET 4.0 application we can
gather performance data for an individual
ASP.NET Application.

Settings
in the

Aspnet.config

file


<
configuration
>



<runtime>





<
appDomainResourceMonitoring
enabled="true"/>


</
runtime
>


</configuration>

Permanently Redirecting

N
ew
RedirectPermanent method that makes it
easy to issue HTTP 301 Moved Permanently
responses
.


Example
:

Response.RedirectPermanent("newlocation/p
age.aspx");

Routing

Routing Mechanism

.


Essential Points for a URL


A domain name that is easy to remember and
easy to spell


Short URLs


Easy to type URLs


URLs that visualize site structure


Persistent
URLs that don't change


URL Routing in .NET 4.0


Namespace:

System.Web.Routing

public Route MapPageRoute(
string

routeName
,
string

routeUrl,
string

physicalFile,
bool

checkPhysicalUrlAccess, RouteValueDictionary
defaults )

Example
:

routes.MapPageRoute("","Category
/{action}/{
ca
tegoryName
}"
,
"~/categoriespage.aspx"
,
true
,
new

RouteValueDictionary {{
"
categoryName
"
,
"food"
}, {
"action"
,
"show"
}});

Setting Meta Tags

ASP.NET 4 introduces the new properties MetaKeywords
and MetaDescription to the Page class. The @Page
directive contains the Keywords and Description
attribute.


Example:

Page.MetaDescription=“
This is the default page


Page.MetaKeywords=“
This is the default page





Better control of the
viewstate

View state can be opt in ViewStateMode



Enabled


Disabled


Inherit

Setting Client
ID

4 Modes



AutoID


Static


Inherit


Predictable

Chart Control


35 distinct chart types


An unlimited number of chart
areas,titles
,
legends, and annotations


3
-
D support for most chart types


Strip Lines, scale breaks, and
logarithimic

scaling


Simple binding and manipulation of chart data.


State management


Binary streaming


Support for common data formats, such as date,
time and currency.




THANK YOU !!