1 / 36

ASP.NET 4.0 and VS 2010 Web Development Beta 1

VTALKS #12 @Microsoft Thailand All Season Place. ASP.NET 4.0 and VS 2010 Web Development Beta 1. Chalermpon Areepong : Nine ( นาย ) Microsoft MVP Thailand Greatfriends.biz Community Lead. Agenda. Web Forms Core Services Web Designer Improvement Web Application Deployment Dynamic Data

phyliss
Download Presentation

ASP.NET 4.0 and VS 2010 Web Development Beta 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VTALKS #12 @Microsoft Thailand All Season Place ASP.NET 4.0 andVS 2010 Web Development Beta 1 Chalermpon Areepong : Nine (นาย)Microsoft MVP ThailandGreatfriends.biz Community Lead

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

  3. ASP.NET 4.0 Web Forms Feature

  4. 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“;

  5. 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

  6. 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.

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

  8. 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.asaxApplication_Start() Event

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

  10. 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

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

  12. 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>

  13. 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.

  14. 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>

  15. ASP.NET 4.0 Core Services Feature

  16. 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>

  17. 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

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

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

  20. 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> • <outputCachedefaultProvider="AspNetInternalProvider"> • <providers> • <add name="DiskCache" type="Test.OutputCacheEx.DiskOutputCacheProvider, DiskCacheProvider" /> • </providers> • </outputCache> • </caching>

  21. 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\configapplicationHost.config <applicationPools> <add name="MyApplicationPool" startMode="AlwaysRunning" /> </applicationPools>

  22. 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>

  23. 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. } }

  24. 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");

  25. 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" />

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

  27. Extensible Request Validation • Prevent Cross-site scripting (XSS) attacks • Validate Process on HttpRuntime, add tag in web.config • Customizable with your code <httpRuntimerequestValidationType="Samples.MyValidator, Samples" /> public class CustomRequestValidation : RequestValidator { protected override boolIsValidRequestString( HttpContext context, string value, RequestValidationSourcerequestValidationSource, string collectionKey, out intvalidationFailureIndex) { ... } }

  28. 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!

  29. 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 <httpRuntimeencoderType="Samples.MyCustomEncoder, Samples" />

  30. 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>

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

  32. 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.

  33. ASP.NET Chart Control

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

  35. 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

  36. Resource • Visual Studio 2010 Beta 1 • http://go.microsoft.com/?linkid=9666892 • ASP.NET 4.0 Beta 2 Documentation • http://www.asp.net/learn/whitepapers/aspnet40 • http://weblogs.asp.net/scottgu

More Related