ASP.net 4.0 WebForm and Core Runtime<br />Le novità per lo sviluppo web(Form) e del runtime<br />Andrea Colaci<br />
ASP.net 4.0 WebForm<br />New project templates, snippets, deployment<br />Controls (ClientId, ViewState)<br />Routing<br /...
ASP.net 4.0 WebForm<br />Visual Studio 2010<br />New project templates, JQuery, snippets<br />Server controls enhancements...
Granular ViewState<br />@Page EnableViewState=False<br />Control1 ViewStateMode=Enabled<br />
ClientID<br />AutoId: generato automaticamente<br />Ctr00_ShopCartExpanded<br />Static: impostato manualmente (da markup)<...
ClientID<br />“It is up to you to make sure that the rendered control IDs are unique.<br />If they are not, it can break a...
17/01/2008<br />www.xedotnet.org<br />7<br />VS2010, Granular ViewState, ControlId<br />DEMO<br />
Routing<br />www.mySite.com/BikesCatalog.aspx?Year=2010&CategoryId=79&Page=2<br />www.mySite.com/2010/Bikes/OffRoad/2<br /...
SEO friendly
Discaccoppiamento tra url fisico e logico
Gestione centralizzata</li></li></ul><li>Routing != URL Rewriting<br /><ul><li>ASP.Net UrlMappings (dalla 2.0)
Riscrive l’url prima che la request sia gestita (Module)
Sintassi dichiarativa (web.config)
Impatto (quasi) zero
URLRewriter.net
API
RegEx per manipolazione Querystring
Form proprietario (gestione postback)</li></li></ul><li>Routing != URL Rewriting<br />
ASP.net 4.0 Routing<br /><ul><li>REST-ful
Introdotto in ASP.net 3.5 SP1
Evoluto con ASP.net MVC
Disponibile a pieno titolo in WebForm 4.0
System.Web.Routing
UrlRoutingModule
RouteTable
Expression builders (<%$ ... %>)
RouteUrlExpressionBuilder
RouteValueExpressionBuilder</li></li></ul><li>Routing<br />www.mySite.com/Catalog/Bikes<br />Request<br />RouteTable<br />...
17/01/2008<br />www.xedotnet.org<br />13<br />Routing<br />DEMO<br />
Deployment<br /><ul><li>Web.config transformations (simile ad EntLib configuration, ma basato XSLT)
Upcoming SlideShare
Loading in...5
×

ASP.NET 4.0

2,319

Published on

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
2,319
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

ASP.NET 4.0

  1. 1. ASP.net 4.0 WebForm and Core Runtime<br />Le novità per lo sviluppo web(Form) e del runtime<br />Andrea Colaci<br />
  2. 2. ASP.net 4.0 WebForm<br />New project templates, snippets, deployment<br />Controls (ClientId, ViewState)<br />Routing<br />Deployment<br />ASP.net 4.0 Runtime<br />appDomain Resource Monitoring «ARM»<br />IIS integration: wp auto-start & application warm-up<br />Session Activation & Compression<br />OutputCache provider extensibility, out-of-proc Cache<br />Agenda<br />
  3. 3. ASP.net 4.0 WebForm<br />Visual Studio 2010<br />New project templates, JQuery, snippets<br />Server controls enhancements<br />New browser-capability files (nuovi devices)<br />CheckBoxList, RadioButtonList<br />RepeatLayout: UnorderedList, OrderedList, Flow, Table<br />ChangePassword, FormView, Login, PasswordRecovery<br />RenderOuterTable<br />Granular ViewState, ClientId<br />Routing in WebForm 4.0<br />Deployment<br />
  4. 4. Granular ViewState<br />@Page EnableViewState=False<br />Control1 ViewStateMode=Enabled<br />
  5. 5. ClientID<br />AutoId: generato automaticamente<br />Ctr00_ShopCartExpanded<br />Static: impostato manualmente (da markup)<br />ShopCartExpanded<br />Inherit: stessa modalità controllo parent.<br />Predictable: per controlli databound, ClientIdRowSuffix (suffisso = proprietà del DataSource es. ProductId)<br />Ctr10_Quantity_775<br />
  6. 6. ClientID<br />“It is up to you to make sure that the rendered control IDs are unique.<br />If they are not, it can break any functionality that requires unique IDs for individual HTML elements, such as the client document.getElementById function.”<br />Fonte: ASP.net 4.0 Whitepaper <br />
  7. 7. 17/01/2008<br />www.xedotnet.org<br />7<br />VS2010, Granular ViewState, ControlId<br />DEMO<br />
  8. 8. Routing<br />www.mySite.com/BikesCatalog.aspx?Year=2010&CategoryId=79&Page=2<br />www.mySite.com/2010/Bikes/OffRoad/2<br /><ul><li>Hackable urls
  9. 9. SEO friendly
  10. 10. Discaccoppiamento tra url fisico e logico
  11. 11. Gestione centralizzata</li></li></ul><li>Routing != URL Rewriting<br /><ul><li>ASP.Net UrlMappings (dalla 2.0)
  12. 12. Riscrive l’url prima che la request sia gestita (Module)
  13. 13. Sintassi dichiarativa (web.config)
  14. 14. Impatto (quasi) zero
  15. 15. URLRewriter.net
  16. 16. API
  17. 17. RegEx per manipolazione Querystring
  18. 18. Form proprietario (gestione postback)</li></li></ul><li>Routing != URL Rewriting<br />
  19. 19. ASP.net 4.0 Routing<br /><ul><li>REST-ful
  20. 20. Introdotto in ASP.net 3.5 SP1
  21. 21. Evoluto con ASP.net MVC
  22. 22. Disponibile a pieno titolo in WebForm 4.0
  23. 23. System.Web.Routing
  24. 24. UrlRoutingModule
  25. 25. RouteTable
  26. 26. Expression builders (<%$ ... %>)
  27. 27. RouteUrlExpressionBuilder
  28. 28. RouteValueExpressionBuilder</li></li></ul><li>Routing<br />www.mySite.com/Catalog/Bikes<br />Request<br />RouteTable<br />UrlRoutingModule<br />IHttpModule<br />PageRouteHandler<br />PageRouteHandler<br />CustomRouteHandler<br />Response<br />Catalog.aspx IHttpHandler<br />ProcessRequest(HttpContext context)<br />
  29. 29. 17/01/2008<br />www.xedotnet.org<br />13<br />Routing<br />DEMO<br />
  30. 30. Deployment<br /><ul><li>Web.config transformations (simile ad EntLib configuration, ma basato XSLT)
  31. 31. Web Packages (MSDeploy)
  32. 32. IIS Settings, GAC, COM, SQL DB, Security
  33. 33. One-click Publishing
  34. 34. Sfrutta IIS Remote Management
  35. 35. Hosters che supportano One-click (vedi links)</li></li></ul><li>Web.config transformations<br />
  36. 36. Web deployment<br /><ul><li>Pages
  37. 37. Content
  38. 38. IIS Settings
  39. 39. Database Schema + Data + Custom Scripts</li></li></ul><li>17/01/2008<br />www.xedotnet.org<br />17<br />Web.config transform, one-click deployment<br />DEMO<br />
  40. 40. 17/01/2008<br />www.xedotnet.org<br />18<br />PaRTE 2: RUNTIME<br />
  41. 41. ARM (appDomain resource monitoring)<br />Introdotti con in CLR 4<br />ASP.net esponeperf. Counters per ogniAppDomain<br /><ul><li>Managed Memory Used
  42. 42. % Managed Processor Time
  43. 43. …</li></ul>Deveessereabilitato (è off di default)<br /><ul><li>Aspnet.config (IIS-CLR low level settings)
  44. 44. Implica un overhead
  45. 45. Campionamentoogni 5 secondi</li></li></ul><li>17/01/2008<br />www.xedotnet.org<br />20<br />ARM AppDomain Resource Monitoring<br />DEMO<br />
  46. 46. IIS 7.5 integration & warm-up<br />IIS 7.5<br /><ul><li>Auto-start worker process
  47. 47. Http services
  48. 48. Non http services (WCF netTcp, WF)
  49. 49. Il team di IIS ha creato un application Warm-up module
  50. 50. Sfruttabile da applicazioni ASP.net < 4.0
  51. 51. Si integra con applicazioni ASP.net 4.0 (web.config)</li></ul>Application Warm-Up<br /><ul><li>Utile in contesti di sincronizzazione di più applicazioni
  52. 52. Fornisce un entry point per eseguire codice custom di inizializzazione (no HttpContext)
  53. 53. ApplicationHost.config (%windir%system32inetsrvconfig)
  54. 54. IProcessHostPreloadClient</li></li></ul><li>IProcessHostPreloadClient<br />AppPool<br />Data Store<br />Cache<br />Custom Warm-up code IProcessHostPreloadClient<br />Request<br />Business App<br />Request<br />Consumer App<br />Request<br />
  55. 55. Windows Server AppFabric Caching (a.k.a. Velocity)<br />Cache distribuita (MemCached, ScaleOut State Server, NCache)<br />In-memory, scalabile, fault-tolerant<br />Componente di Windows Server 2008<br />Server installabile anche su Windows7 e Vista<br />H.A. richiede Windows Server 2008 Enterprise<br />Parte server richiede .net fx 4.0<br />Client library richiede .net fx 3.5 o superiore<br />SessionProvider per ASP.net (3.5)<br />AppFabric Cache<br />
  56. 56. 17/01/2008<br />www.xedotnet.org<br />24<br />IIS 7.5 integration & warm-up<br />DEMO<br />
  57. 57. Session in ASP.net 4.0<br />Automatic compression<br /><ul><li>Si abilita da web.config
  58. 58. Solo per i providers out-of-process (StateServer SQLServer)
  59. 59. Usa GZipStream
  60. 60. Riduzione fino a 2/3 della dimensione iniziale
  61. 61. Implica un overhead ad ogni request (tradeoffs?)</li></ul>Programmatic activation<br /><ul><li>Abilita/Disabilita l’uso della sessione (per request)
  62. 62. HttpModule + SetSessionStateBehavior()</li></li></ul><li>17/01/2008<br />www.xedotnet.org<br />26<br />Session in ASP.net 4.0<br />DEMO<br />
  63. 63. OutputCache extensibility<br />OutputCache (da sempre!)<br /><ul><li>Disponibile per WebForm & MVC (action filters)
  64. 64. Aumenta drasticamente le prestazioni
  65. 65. Consente di memorizzare la Response di
  66. 66. Pagine intere
  67. 67. UserControls .ascx (fragment cache)</li></ul>Output Cache (da ASP.net 4.0)<br /><ul><li>Disk-based & AppFabric providers (post-RTM)
  68. 68. Estendibile/Personalizzabile</li></ul>Implementare OutputCacheProvider (abstract class)<br />Dichiarare il provider (web.config)<br />Override GetOutputCacheProviderName (global.asax)<br />
  69. 69. 17/01/2008<br />www.xedotnet.org<br />28<br />OutputCache extensibility<br />DEMO<br />
  70. 70. Links<br />IIS7.5 WarmupModule<br />http://www.iis.net/expand/applicationwarmup<br />AppFabric<br />http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx<br />http://blogs.ugidotnet.org/AndreaCol/category/3613.aspx<br />ASP.net 4.0 Routing<br />http://www.4guysfromrolla.com/articles/012710-1.aspx<br />SmartyRoute - http://bit.ly/PRA6G<br />Try ASP.net 4.0 & one-click deploy (free)<br />http://labs.discountasp.net/<br />http://www.orcsweb.com/hosting/vs2010beta.aspx<br />http://aspnet4beta.maximumasp.com/<br />
  71. 71. Link<br />17/01/2008<br />www.xedotnet.org<br />30<br />Riferimenti<br />Blogs.ugidotnet.org/AndreaCol<br />Andrea.colaci79@gmail.com<br />www.andreacol.net <br />AndreaColaci<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×