ASP.NET4.0 and Visual Web Developer 2010 Features

0

No comments posted yet

Comments

Slide 18

ปกติ Cache ใน asp.net นั้นจะมีแค่ Session State Sql Server State แต่ที่มีเพิ่มเติมเข้านั้นคือ Output Cache Provider

Slide 1

Microsoft Developer User Group - Hyderabad ASP.NET 4.0 and VS 2010 Web Development “ Sharing is our Passion “

Slide 2

ASP.NET 4.0 and VS 2010 Web Development World Record Session @ http://www.hyderabadtechies.info Nithin Mohan T K Technology Specialist Member, Hyderabad Techies – Microsoft Developer User Group

Slide 3

Agenda Web Forms Core Services Web Designer Improvement Web Application Deployment Dynamic Data AJAX Functionality in ASP.NET 4.0

Slide 4

ASP.NET 4.0 Web Forms Feature

Slide 5

Set meta tags on Web Forms Feature for Search Engine Optimize (SEO) Allow set page meta tags keywords description With Coding Demo this.MetaKeywords = "Greatfriends.biz, Visual Studio 2010, .NET, ASP.NET 4.0, SilverLight, Team System 2010"; this.MetaDescription = "VTALKS #12“;

Slide 6

View State for Individual Controls ViewStateMode tag Enabled (default value) Disabled Inherit Able to specify for each control Able to force all control at Page Directive Demo

Slide 7

Browser Capabilities Using determines browser that user is using browse to you site. To get user browser information HTML, XHTML support version JavaScript version Mobile Browser HttpBrowserCapabilities object after using this feature.

Slide 8

Browser Capabilities blackberry.browser chrome.browser Default.browser firefox.browser gateway.browser generic.browser ie.browser iemobile.browser iphone.browser opera.browser safari.browser New Browser Definition Files:

Slide 9

Using Browser Capabilities Providers Using ASP.NET Standard Browser Capabilities Use aspnet_regbrowsers.exe –i , It’s will create ASP.BrowserCapsFactory.dll and install to GAC Restart IIS iisreset Custom your Browser Capabilities Derived HttpCapabilitiesProvider Class Override GetBrowserCapabilities Method to return your BC. Register to web.config <browserCaps … Use in Global.asax Application_Start() Event

Slide 10

Browser Capabilities Providers HttpBrowserCapabilities object caching Extending ASP.NET Browser Capabilities Functionality Extending Browser Capabilities Functionality by Adding New Capabilities to Existing Capabilities Definitions

Slide 11

ASP.NET Web Forms Routing Let you configure new simple URL SEO Optimize It Likes ASP.NET MVC Routing Such as from http://website/products.aspx?categoryid=12 To new URL http://website/products/software

Slide 12

ASP.NET Web Forms Routing Map routing in Global.asax file on Application_Start() Event, Add RouteTable.Routes.MapPageRoute() method checkPhysicalUrlAccess for restrict URL access permission Reading Routing Information in a Web Forms Page Page.RouteData.Values["searchterm"] as string; value “http://localhost/search/scott/”

Slide 13

ASP.NET Web Forms Routing Accessing Routing Information in Markup <asp:HyperLink ID="HyperLink1" runat="server“ NavigateUrl="<%$RouteUrl:SearchTerm=scott%>">Search for Scott</asp:HyperLink> value “http://localhost/search/scott/” Using Route Data for Data Source Control Parameters RouteParameter class lets you specify route data as a parameter value for queries in a data source control. It works much like FormParameter <asp:sqldatasource id="SqlDataSource1" runat="server“ connectionstring="<%$ ConnectionStrings:MyNorthwind %>” selectcommand="SELECT CompanyName,ShipperID FROM Shippers where CompanyName=@companyname“ <selectparameters><asp:routeparameter name="companyname" RouteKey="searchterm" /></selectparameters></asp:sqldatasource>

Slide 14

ASP.NET 4.0 Client ID Control ID Feature ClientIDMode AutoID – Auto Generate by ASP.NET. Static – Fix ID Predictable – For repeating template control, in ClientIDRowSuffix should be PrimaryKey or Object ID Inherit –default behavior, same as its parent.

Slide 15

Persisting Row Selection in Data Controls Persist Selected Row Enabled for GridView and ListView controls Use EnablePersistedSelection <asp:GridView id="GridView2" runat="server" EnablePersistedSelection="true"> </asp:GridView>

Slide 16

ASP.NET 4.0 Core Services Feature

Slide 17

Web.config File Minification Move major configuration to machine.config, and leave your new configuration only Able to override value on web.config <?xml version="1.0"?> <configuration> <system.web> <compilation targetFramework="4.0" /> </system.web> </configuration>

Slide 18

Extensible Output Caching Session State SQL Server State Output Cache Providers (New) Allow your set default cache provider Able to customize your output cache provider Able to configure one or more

Slide 19

New 4.0 Cache Functionality Cache Namespace System.Caching { } CacheProvider Disk based Windows Azure Distributed In-memory

Slide 20

New 4.0 Output Cache Functionality Namespace System.Web.Caching { } Disk based Windows Azure Distributed In-memory OutputCacheProvider Default.aspx Foo.ascx

Slide 21

Extensible Output Caching Add Output Cache Provider in web.config Can specify page to use output cache provider with Page and Control Directive <%@ OutputCache Duration="60" VaryByParam="None" providerName="DiskCache" %> Configure all in Global.asax public override string GetOutputCacheProviderName(HttpContext context) <caching> <outputCache defaultProvider="AspNetInternalProvider"> <providers> <add name="DiskCache" type="Test.OutputCacheEx.DiskOutputCacheProvider, DiskCacheProvider" /> </providers> </outputCache> </caching>

Slide 22

Auto-Start Web Applications Many web app need to load initialize data. This expensive to do Solve the first requests Timeout problem Wake up asp.net app with your custom code on Application_Load Event in Global.asax file For ASP.NET 4.0 + IIS 7.5 + Win2K8 R2 Only Config in %Windows%\System32\inetsrv\config applicationHost.config <applicationPools> <add name="MyApplicationPool" startMode="AlwaysRunning" /> </applicationPools>

Slide 23

Auto-Start Web Applications specify individual applications pool to be automatically started <sites> <site name="MySite" id="1"> <application path="/“ preloadEnabled="true“ preloadProvider="PrewarmMyCache" > <!-- Additional content --> </application> </site> </sites>  <!-- Additional content   <preloadProviders> <add name="PrewarmMyCache" type="MyNamespace.CustomInitialization, MyLibrary" /> </preloadProviders>

Slide 24

Auto-Start Web Applications For implement PreloadProvider using System.Web.Hosting.IProcessHostPreloadClient public class CustomInitialization : System.Web.Hosting.IProcessHostPreloadClient { public void Preload(string[] parameters) { // Perform initialization. } }

Slide 25

Permanently Redirecting a Page Feature for Search Engine Optimize (SEO) Generate Http 301 on response header and attached new URL of request page Just call this method Response. RedirectPermanent("/newpath/foroldcontent.aspx");

Slide 26

The Incredible Shrinking Session State Support both out-of-process and session-state providers Just configure in web.config <sessionState mode="SqlServer" sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate" allowCustomSqlDatabase="true" compressionEnabled="true" />

Slide 27

Expanding the Range of Allowable URLs Expand URL range from 260 characters (old asp.net) to customize value Customize request path validator <httpRuntime maxRequestPathLength="260" maxQueryStringLength="2048" /> <httpRuntime requestPathInvalidChars="<,>,*,%,&,:,\" />

Slide 28

Extensible Request Validation Prevent Cross-site scripting (XSS) attacks Validate Process on HttpRuntime, add tag in web.config Customizable with your code <httpRuntime requestValidationType="Samples.MyValidator, Samples" /> public class CustomRequestValidation : RequestValidator { protected override bool IsValidRequestString( HttpContext context, string value, RequestValidationSource requestValidationSource, string collectionKey, out int validationFailureIndex) { ... } }

Slide 29

Object Caching and Object Caching Extensibility New MemoryCache class in System.Runtime.Caching.dll Allow call from any Application Type without System.Web.dll dependency For do this required documentation for implement, Please wait!

Slide 30

Extensible HTML, URL, and HTTP Header Encoding System.Web.Util.HttpEncoder Extensible to create Custom Encoding on HttpRuntime Add custom encoding in web.config file <httpRuntime encoderType="Samples.MyCustomEncoder, Samples" />

Slide 31

Performance Monitoring for Individual Applications in a Single Worker Process Diagnostic worker process feature by CRL Admin can configure in aspnet.config file <?xml version="1.0" encoding="UTF-8" ?> <configuration> <runtime> <appDomainResourceMonitoring enabled="true"/> </runtime> </configuration>

Slide 32

Multi-Targeting Allow to specify version of .NET framework <Codedom> <compilation targetFramework="4.0"/> …..

Slide 33

ASP.NET Chart Control 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.

Slide 34

ASP.NET Chart Control

Slide 35

Visual Studio 2010 Web Designer Improvements Improved CSS Compatibility using CSS 2.1 HTML and JScript Snippets JScript IntelliSense Enhancements

Slide 36

Web Application Deployment with Visual Studio 2010 Web packaging 10 + 20 reasons why you should create a Web Package Web.config Transformation Web Deployment: Web.Config Transformation Database deployment Database Deployment with VS 2010 One-Click Publish for Web applications Web 1-Click Publish with VS 2010

Slide 37

Resource Visual Studio 2010 Beta 2 http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx ASP.NET 4.0 Beta 2 Documentation http://www.asp.net/learn/whitepapers/aspnet40 http://weblogs.asp.net/scottgu

Slide 38

Q & A

Slide 39

I blog @ http://www.nithinmohantk.info Thank you all Visit our website http://www.hyderabadtechies.info

Summary: ASP.NET4.0 and Visual Web Developer 2010 Features

Tags: asp.net4.0 and visual web developer 2010 features

URL: