Asynchronous reading and writing http r equest
Upcoming SlideShare
Loading in...5

Asynchronous reading and writing http r equest






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Asynchronous reading and writing http r equest Asynchronous reading and writing http r equest Document Transcript

  • ASP.NET Core Runtime and FrameworkAsynchronously Reading and Writing HTTP Requests and ResponsesASP.NET 4 introduced the ability to read an HTTP request entity as a stream using theHttpRequest.GetBufferlessInputStream method. This method provided streaming access to the requestentity. However, it executed synchronously, which tied up a thread for the duration of a request.ASP.NET 4.5 supports the ability to read streams asynchronously on an HTTP request entity, and the abilityto flush asynchronously. ASP.NET 4.5 also gives you the ability to double-buffer an HTTP request entity,which provides easier integration with downstream HTTP handlers such as .aspx page handlers andASP.NET MVC controllers.Improvements to HttpRequest handlingThe Stream reference returned by ASP.NET 4.5 from HttpRequest.GetBufferlessInputStream supports bothsynchronous and asynchronous read methods. The Stream object returned from GetBufferlessInputStreamnow implements both the BeginRead and EndRead methods. The asynchronous Stream methods let youasynchronously read the request entity in chunks, while ASP.NET releases the current thread between eachiteration of an asynchronous read loop.ASP.NET 4.5 has also added a companion method for reading the request entity in a buffered way:HttpRequest.GetBufferedInputStream. This new overload works like GetBufferlessInputStream, supportingboth synchronous and asynchronous reads. However, as it reads, GetBufferedInputStream also copies theentity bytes into ASP.NET internal buffers so that downstream modules and handlers can still access therequest entity. For example, if some upstream code in the pipeline has already read the request entity usingGetBufferedInputStream, you can still use HttpRequest.Form or HttpRequest.Files. This lets you performasynchronous processing on a request (for example, streaming a large file upload to a database), but stillrun .aspx pages and MVC ASP.NET controllers afterward.Asynchronously flushing a responseSending responses to an HTTP client can take considerable time when the client is far away or has a low-bandwidth connection. Normally ASP.NET buffers the response bytes as they are created by an application.ASP.NET then performs a single send operation of the accrued buffers at the very end of requestprocessing.If the buffered response is large (for example, streaming a large file to a client), you must periodically callHttpResponse.Flush to send buffered output to the client and keep memory usage under control. However,because Flush is a synchronous call, iteratively calling Flush still consumes a thread for the duration ofpotentially long-running requests.
  • ASP.NET 4.5 adds support for performing flushes asynchronously using the BeginFlush and EndFlushmethods of the HttpResponse class. Using these methods, you can create asynchronous modules andasynchronous handlers that incrementally send data to a client without tying up operating-system threads.In between BeginFlush and EndFlush calls, ASP.NET releases the current thread. This substantially reducesthe total number of active threads that are needed in order to support long-running HTTP downloads.Support for await and Task-Based Asynchronous Modules andHandlersThe .NET Framework 4 introduced an asynchronous programming concept referred to as a task. Tasks arerepresented by the Task type and related types in the System.Threading.Tasks namespace. The .NETFramework 4.5 builds on this with compiler enhancements that make working with Task objects simple. Inthe .NET Framework 4.5, the compilers support two new keywords: await and async. The await keyword issyntactical shorthand for indicating that a piece of code should asynchronously wait on some other piece ofcode. The async keyword represents a hint that you can use to mark methods as task-based asynchronousmethods.The combination of await, async, and the Task object makes it much easier for you to write asynchronouscode in .NET 4.5. ASP.NET 4.5 supports these simplifications with new APIs that let you write asynchronousHTTP modules and asynchronous HTTP handlers using the new compiler enhancements.Asynchronous HTTP modulesSuppose that you want to perform asynchronous work within a method that returns a Task object. Thefollowing code example defines an asynchronous method that makes an asynchronous call to downloadthe Microsoft home page. Notice the use of the async keyword in the method signature and the await callto DownloadStringTaskAsync.privateasyncTaskScrapeHtmlPage(objectcaller,EventArgs e){WebClientwc=newWebClient();var result = awaitwc.DownloadStringTaskAsync("");// Do something with the result
  • }Thats all you have to write — the .NET Framework will automatically handle unwinding the call stack whilewaiting for the download to complete, as well as automatically restoring the call stack after the download isdone.Now suppose that you want to use this asynchronous method in an asynchronous ASP.NET HTTP module.ASP.NET 4.5 includes a helper method (EventHandlerTaskAsyncHelper) and a new delegate type(TaskEventHandler) that you can use to integrate task-based asynchronous methods with the olderasynchronous programming model exposed by the ASP.NET HTTP pipeline. This example shows how:publicvoidInit(HttpApplicationcontext){// Wrap the Task-based method so that it can be used with// the older async programming model.EventHandlerTaskAsyncHelper helper =newEventHandlerTaskAsyncHelper(ScrapeHtmlPage);// The helper object makes it easy to extract Begin/End methods out of// a method that returns a Task object. The ASP.NET pipeline calls the// Begin and End methods to start and complete calls on asynchronous// HTTP modules.context.AddOnPostAuthorizeRequestAsync(
  • helper.BeginEventHandler,helper.EndEventHandler);}Asynchronous HTTP handlersThe traditional approach to writing asynchronous handlers in ASP.NET is to implement theIHttpAsyncHandler interface. ASP.NET 4.5 introduces the HttpTaskAsyncHandler asynchronous base typethat you can derive from, which makes it much easier to write asynchronous handlers.The HttpTaskAsyncHandler type is abstract and requires you to override the ProcessRequestAsync method.Internally ASP.NET takes care of integrating the return signature (a Task object) of ProcessRequestAsync withthe older asynchronous programming model used by the ASP.NET pipeline.The following example shows how you can use Task and await as part of the implementation of anasynchronous HTTP handler:publicclassMyAsyncHandler:HttpTaskAsyncHandler{// ...// ASP.NET automatically takes care of integrating the Task basedoverride// with the ASP.NET pipeline.publicoverrideasyncTaskProcessRequestAsync(HttpContext context){WebClientwc=newWebClient();var result = await
  • wc.DownloadStringTaskAsync("");// Do something with the result}}New ASP.NET Request Validation FeaturesBy default, ASP.NET performs request validation — it examines requests to look for markup or script infields, headers, cookies, and so on. If any is detected, ASP.NET throws an exception. This acts as a first lineof defense against potential cross-site scripting attacks.ASP.NET 4.5 makes it easy to selectively read unvalidated request data. ASP.NET 4.5 also integrates thepopular AntiXSS library, which was formerly an external library.Developers have frequently asked for the ability to selectively turn off request validation for theirapplications. For example, if your application is forum software, you might want to allow users to submitHTML-formatted forum posts and comments, but still make sure that request validation is checkingeverything else.ASP.NET 4.5 introduces two features that make it easy for you to selectively work with unvalidated input:deferred ("lazy") request validation and access to unvalidated request data.Deferred ("lazy") request validationIn ASP.NET 4.5, by default all request data is subject to request validation. However, you can configure theapplication to defer request validation until you actually access request data. (This is sometimes referred toas lazy request validation, based on terms like lazy loading for certain data scenarios.) You can configurethe application to use deferred validation in the Web.config file by setting the requestValidationModeattribute to 4.5 in the httpRUntime element, as in the following example:<httpRuntimerequestValidationMode="4.5" ... />When request validation mode is set to 4.5, request validation is triggered only for a specific request valueand only when your code accesses that value. For example, if your code gets the value ofRequest.Form["forum_post"], request validation is invoked only for that element in the form collection.None of the other elements in the Form collection are validated. In previous versions of ASP.NET, request
  • validation was triggered for the entire request collection when any element in the collection was accessed.The new behavior makes it easier for different application components to look at different pieces of requestdata without triggering request validation on other pieces.Support for unvalidated requestsDeferred request validation alone doesnt solve the problem of selectively bypassing request validation. Thecall to Request.Form["forum_post"] still triggers request validation for that specific request value. However,you might want to access this field without triggering validation because you want to allow markup in thatfield.To allow this, ASP.NET 4.5 now supports unvalidated access to request data. ASP.NET 4.5 includes a newUnvalidated collection property in the HttpRequest class. This collection provides access to all of thecommon values of request data, like Form, QueryString, Cookies, and Url.Using the forum example, to be able to read unvalidated request data, you first need to configure theapplication to use the new request validation mode:<httpRuntimerequestValidationMode="4.5" .../>You can then use the HttpRequest.Unvalidated property to read the unvalidated form value:var s =context.Request.Unvalidated.Form["forum_post"];Security Note: Use unvalidated request data with care! ASP.NET 4.5 added the unvalidated requestproperties and collections to make it easier for you to access very specific unvalidated request data.However, you must still perform custom validation on the raw request data to ensure that dangerous text isnot rendered to users.AntiXSS LibraryDue to the popularity of the Microsoft AntiXSS Library, ASP.NET 4.5 now incorporates core encodingroutines from version 4.0 of that library.The encoding routines are implemented by the AntiXssEncoder type in the new System.Web.Security.AntiXssnamespace. You can use the AntiXssEncoder type directly by calling any of the static encoding methods thatare implemented in the type. However, the easiest approach for using the new anti-XSS routines is to
  • configure an ASP.NET application to use the AntiXssEncoder class by default. To do this, add the followingattribute to the Web.config file:<httpRuntime ...encoderType="System.Web.Security.AntiXss.AntiXssEncoder,System.Web,Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>When the encoderType attribute is set to use the AntiXssEncoder type, all output encoding in ASP.NETautomatically uses the new encoding routines.These are the portions of the external AntiXSS library that have been incorporated into ASP.NET 4.5:HtmlEncode, HtmlFormUrlEncode, and HtmlAttributeEncodeXmlAttributeEncode and XmlEncodeUrlEncode and UrlPathEncode (new)CssEncodeSupport for WebSockets ProtocolWebSockets protocol is a standards-based network protocol that defines how to establish secure, real-timebidirectional communications between a client and a server over HTTP. Microsoft has worked with both theIETF and W3C standards bodies to help define the protocol. The WebSockets protocol is supported by anyclient (not just browsers), with Microsoft investing substantial resources supporting WebSockets protocolon both client and mobile operating systems.WebSockets protocol makes it much easier to create long-running data transfers between a client and aserver. For example, writing a chat application is much easier because you can establish a true long-runningconnection between a client and a server. You do not have to resort to workarounds like periodic polling orHTTP long-polling to simulate the behavior of a socket.ASP.NET 4.5 and IIS 8 include low-level WebSockets support, enabling ASP.NET developers to use managedAPIs for asynchronously reading and writing both string and binary data on a WebSockets object. ForASP.NET 4.5, there is a new System.Web.WebSockets namespace that contains types for working withWebSockets protocol.A browser client establishes a WebSockets connection by creating a DOM WebSocket object that points to aURL in an ASP.NET application, as in the following example:socket=newWebSocket("ws://");
  • You can create WebSockets endpoints in ASP.NET using any kind of module or handler. In the previousexample, an .ashx file was used, because .ashx files are a quick way to create a handler.According to the WebSockets protocol, an ASP.NET application accepts a clients WebSockets request byindicating that the request should be upgraded from an HTTP GET request to a WebSockets request. Heresan example:HttpContext.Current.AcceptWebSocketRequest(// WebSocket delegate goes here)The AcceptWebSocketRequest method accepts a function delegate because ASP.NET unwinds the currentHTTP request and then transfers control to the function delegate. Conceptually this approach is similar tohow you use System.Threading.Thread, where you define a thread-start delegate in which background workis performed.After ASP.NET and the client have successfully completed a WebSockets handshake, ASP.NET calls yourdelegate and the WebSockets application starts running. The following code example shows a simple echoapplication that uses the built-in WebSockets support in ASP.NET:publicasyncTaskMyWebSocket(AspNetWebSocketContext context){WebSocket socket =context.WebSocket;while(true){ArraySegment<byte> buffer =newArraySegment<byte>(newbyte[1024]);// Asynchronously wait for a message to arrive from a clientWebSocketReceiveResult result =awaitsocket.ReceiveAsync(buffer,CancellationToken.None);
  • // If the socket is still open, echo the message back to the clientif(socket.State==WebSocketState.Open){stringuserMessage=Encoding.UTF8.GetString(buffer.Array,0,result.Count);userMessage="You sent: "+userMessage+" at "+DateTime.Now.ToLongTimeString();buffer=newArraySegment<byte>(Encoding.UTF8.GetBytes(userMessage));// Asynchronously send a message to the clientawaitsocket.SendAsync(buffer,WebSocketMessageType.Text,true,CancellationToken.None);}else{break;}}}
  • The support in .NET 4.5 for the await keyword and asynchronous task-based operations is a natural fit forwriting WebSockets applications. The code example shows that a WebSockets request runs completelyasynchronously inside ASP.NET. The application waits asynchronously for a message to be sent from a clientby calling await socket.ReceiveAsync. Similarly, you can send an asynchronous message to a client by callingawait socket.SendAsync.In the browser, an application receives WebSockets messages through an onmessage function. To send amessage from a browser, you call the send method of the WebSocket DOM type, as shown in this example:// Receive a string message from the server.socket.onmessage=function(msg){document.getElementById("serverData");};// Send a string message from the browser.socket.send(document.getElementById("msgText"));In the future, we might release updates to this functionality that abstract away some of the low-level codingthat is required in this release for WebSockets applications.Bundling and MinificationBundling lets you combine individual JavaScript and CSS files into a bundle that can be treated like a singlefile. Minification condenses JavaScript and CSS files by removing whitespace and other characters that arenot required. These features work with Web Forms, ASP.NET MVC, and Web Pages.Bundles are created using the Bundle class or one of its child classes, ScriptBundle and StyleBundle. Afterconfiguring an instance of a bundle, the bundle is made available to incoming requests by simply adding itto a global BundleCollection instance. In the default templates, bundle configuration is performed in aBundleConfig file. This default configuration creates bundles for all of the core scripts and css files used bythe templates.
  • Bundles are referenced from within views by using one of a couple possible helper methods. In order tosupport rendering different markup for a bundle when in debug vs. release mode, the ScriptBundle andStyleBundle classes have the helper method, Render. When in debug mode, Render will generate markupfor each resource in the bundle. When in release mode, Render will generate a single markup element forthe entire bundle. Toggling between debug and release mode can be accomplished by modifying thedebug attribute of the compilation element in web.config as shown below:<system.web><compilationtargetframework="4.5"debug="true"/>...</system.web>Additionally, enabling or disabling optimization can be set directly via the BundleTable.EnableOptimizationsproperty.BundleTable.EnableOptimizations=true;When files are bundled, they are first sorted alphabetically (the way they are displayed in SolutionExplorer). They are then organized so that known libraries and their custom extensions (such as jQuery,MooTools, and Dojo) are loaded first. For example, the final order for the bundling of the Scripts folder asshown above will be:1. jquery-1.6.2.js2. jquery-ui.js3. a.jsCSS files are also sorted alphabetically and then reorganized so that reset.css and normalize.css comebefore any other file. The final sorting of the bundling of the Styles folder shown above will be this:1. reset.css2. content.css3. forms.css4. globals.css5. menu.css6. styles.css
  • Performance Improvements for Web HostingThe .NET Framework 4.5 and Windows 8 introduce features that can help you achieve a significantperformance boost for web-server workloads. This includes a reduction (up to 35%) in both startup timeand in the memory footprint of web hosting sites that use ASP.NET.Key performance factorsIdeally, all websites should be active and in memory to assure quick response to the next request, wheneverit comes. Factors that can affect site responsiveness include:The time it takes for a site to restart after an app pool recycles. This is the time it takes to launch a webserver process for the site when the site assemblies are no longer in memory. (The platformassemblies are still in memory, since they are used by other sites.) This situation is referred to as "coldsite, warm framework startup" or just "cold site startup."How much memory the site occupies. Terms for this are "per-site memory consumption" or "unsharedworking set."The new performance improvements focus on both of these factors.Requirements for New Performance FeaturesThe requirements for the new features can be broken down into these categories:Improvements that run on the .NET Framework 4.Improvements that require the .NET Framework 4.5 but can run on any version of Windows.Improvements that are available only with .NET Framework 4.5 running on Windows 8.Performance increases with each level of improvement that you are able to enable.Some of the .NET Framework 4.5 improvements take advantage of broader performance features that applyto other scenarios as well.Sharing Common AssembliesRequirement: .NET Framework 4 and Visual Studio 11 Developer Preview SDKDifferent sites on a server often use the same helper assemblies (for example, assemblies from a starter kitor sample application). Each site has its own copy of these assemblies in its Bin directory. Even though theobject code for the assemblies is identical, theyre physically separate assemblies, so each assembly has tobe read separately during cold site startup and kept separately in memory.
  • The new interning functionality solves this inefficiency and reduces both RAM requirements and load time.Interning lets Windows keep a single copy of each assembly in the file system, and individual assemblies inthe site Bin folders are replaced with symbolic links to the single copy. If an individual site needs a distinctversion of the assembly, the symbolic link is replaced by the new version of the assembly, and only that siteis affected.Sharing assemblies using symbolic links requires a new tool named aspnet_intern.exe, which lets you createand manage the store of interned assemblies. It is provided as a part of the Visual Studio 11 DeveloperPreview SDK. (However, it will work on a system that has only the .NET Framework 4 installed, assuming youhave installed the latest update.)To make sure all eligible assemblies have been interned, you run aspnet_intern.exe periodically (forexample, once a week as a scheduled task). A typical use is as follows:aspnet_intern-mode exec-sourcedir"C:WindowsMicrosoft.NETFrameworkv4.0.30319Temporary ASP.NET Files"-interndirC:ASPNETCommonAssembliesTo see all options, run the tool with no arguments.Using multi-Core JIT compilation for faster startupRequirement: .NET Framework 4.5For a cold site startup, not only do assemblies have to be read from disk, but the site must be JIT-compiled.For a complex site, this can add significant delays. A new general-purpose technique in the .NET Framework4.5 reduces these delays by spreading JIT-compilation across available processor cores. It does this as muchand as early as possible by using information gathered during previous launches of the site. Thisfunctionality implemented by the System.Runtime.ProfileOptimization.StartProfile method.JIT-compiling using multiple cores is enabled by default in ASP.NET, so you do not need to do anything totake advantage of this feature. If you want to disable this feature, make the following setting in theWeb.config file:<configuration><!-- ... --><system.web>
  • <compilationprofileGuidedOptimizations="None"/><!-- ... -->Tuning garbage collection to optimize for memoryRequirement: .NET Framework 4.5Once a site is running, its use of the garbage-collector (GC) heap can be a significant factor in its memoryconsumption. Like any garbage collector, the .NET Framework GC makes tradeoffs between CPU time(frequency and significance of collections) and memory consumption (extra space that is used for new,freed, or free-able objects). For previous releases, we have provided guidance on how to configure the GCto achieve the right balance (for example, see ASP.NET 2.0/3.5 Shared Hosting Configuration).For the .NET Framework 4.5, instead of multiple standalone settings, a workload-defined configurationsetting is available that enables all of the previously recommended GC settings as well as new tuning thatdelivers additional performance for the per-site working set.To enable GC memory tuning, add the following setting to theWindowsMicrosoft.NETFrameworkv4.0.30319aspnet.config file:<configuration><!-- ... --><runtime><performanceScenariovalue="HighDensityWebHosting"/><!-- ... -->(If youre familiar with the previous guidance for changes to aspnet.config, note that this setting replacesthe old settings — for example, there is no need to set gcServer, gcConcurrent, etc. You do not have toremove the old settings.)Prefetching for web applicationsRequirement: .NET Framework 4.5 running on Windows 8
  • For several releases, Windows has included a technology known as the prefetcher that reduces the disk-readcost of application startup. Because cold startup is a problem predominantly for client applications, thistechnology has not been included in Windows Server, which includes only components that are essential toa server. Prefetching is now available in the latest version of Windows Server, where it can optimize thelaunch of individual websites.For Windows Server, the prefetcher is not enabled by default. To enable and configure the prefetcher forhigh-density web hosting, run the following set of commands at the command line:scconfigsysmain start=autoreg add "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSessionManagerMemory ManagementPrefetchParameters"/v EnablePrefetcher/t REG_DWORD /d2/freg add "HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsNTCurrentVersionPrefetcher"/v MaxPrefetchFiles/t REG_DWORD /d 8192/fnet start sysmainThen, to integrate the prefetcher with ASP.NET applications, add the following to the Web.config file:<configuration><!-- ... --><system.web><compilationenablePrefetchOptimization="true"/><!-- ... -->ASP.NET Web FormsStrongly Typed Data Controls
  • In ASP.NET 4.5, Web Forms includes some improvements for working with data. The first improvement isstrongly typed data controls. For Web Forms controls in previous versions of ASP.NET, you display a data-bound value using Eval and a data-binding expression:<ul><asp:Repeaterrunat="server"ID="customers"><ItemTemplate><li>First Name: <%# Eval("FirstName")%><br/>Last Name: <%# Eval("LastName")%><br/></li></ItemTemplate></asp:Repeater></ul>For two-way data binding, you use Bind:<asp:FormViewrunat="server"ID="editCustomer"><EditItemTemplate><div><asp:Labelrunat="server"AssociatedControlID="firstName">First Name:</asp:Label>
  • <asp:TextBox ID="firstName" runat="server"Text=<%#Bind("FirstName") %> /></div><div><asp:Labelrunat="server"AssociatedControlID="lastName">First Name:</asp:Label><asp:TextBox ID="lastName" runat="server"Text=<%#Bind("LastName") %> /></div><asp:Buttonrunat="server"CommandName="Update"/></EditItemTemplate></asp:FormView>At run time, these calls use reflection to read the value of the specified member and then display the resultin the markup. This approach makes it easy to data bind against arbitrary, unshaped data.However, data-binding expressions like this dont support features like IntelliSense for member names,navigation (like Go To Definition), or compile-time checking for these names.To address this issue, ASP.NET 4.5 adds the ability to declare the data type of the data that a control isbound to. You do this using the new ItemType property. When you set this property, two new typedvariables are available in the scope of data-binding expressions: Item and BindItem. Because the variablesare strongly typed, you get the full benefits of the Visual Studio development experience.
  • For two-way data-binding expressions, use the BindItem variable:<asp:FormViewrunat="server"ID="editCustomer"><EditItemTemplate><div><asp:Labelrunat="server"AssociatedControlID="firstName">First Name:</asp:Label><asp:TextBox ID="firstName" runat="server"Text=<%#BindItem.FirstName%> /></div><div><asp:Labelrunat="server"AssociatedControlID="lastName">First Name:</asp:Label><asp:TextBox ID="lastName" runat="server"Text=<%#BindItem.LastName%> /></div><asp:Buttonrunat="server"CommandName="Update"/></EditItemTemplate></asp:FormView>
  • Most controls in the ASP.NET Web Forms framework that support data binding have been updated tosupport the ItemType property.Model BindingModel binding extends data binding in ASP.NET Web Forms controls to work with code-focused dataaccess. It incorporates concepts from the ObjectDataSource control and from model binding in ASP.NETMVC.Selecting dataTo configure a data control to use model binding to select data, you set the controls SelectMethod propertyto the name of a method in the pages code. The data control calls the method at the appropriate time inthe page life cycle and automatically binds the returned data. Theres no need to explicitly call the DataBindmethod.In the following example, the GridView control is configured to use a method named GetCategories:<asp:GridViewID="categoriesGrid"runat="server"ItemType="WebApplication1.Model.Category"SelectMethod="GetCategories"AutoGenerateColumns="false"><Columns><asp:BoundFieldDataField="CategoryID"HeaderText="ID"/><asp:BoundFieldDataField="CategoryName"HeaderText="Name"/><asp:BoundFieldDataField="Description"HeaderText="Description"/><asp:TemplateFieldHeaderText="# of Products"><ItemTemplate><%# Item.Products.Count%></ItemTemplate>
  • </asp:TemplateField></Columns></asp:GridView>You create the GetCategories method in the pages code. For a simple select operation, the method needsno parameters and should return an IEnumerable or IQueryable object. If the new ItemType property is set(which enables strongly typed data-binding expressions, as explained under Strongly Typed Data Controlsearlier), the generic versions of these interfaces should be returned — IEnumerable<T> or IQueryable<T>,with the T parameter matching the type of the ItemType property (for example, IQueryable<Category>).The following example shows the code for a GetCategories method. This example uses the EntityFramework Code First model with the Northwind sample database. The code makes sure that the queryreturns details of the related products for each category by way of the Include method. (This ensures thatthe TemplateField element in the markup displays the count of products in each category without requiringan n+1 select.)publicIQueryable<Category>GetCategories(){vardb=newNorthwind();returndb.Categories.Include(c =>c.Products);}When the page runs, the GridView control calls the GetCategories method automatically and renders thereturned data using the configured fields:
  • Because the select method returns an IQueryable object, the GridView control can further manipulate thequery before executing it. For example, the GridView control can add query expressions for sorting andpaging to the returned IQueryable object before it is executed, so that those operations are performed bythe underlying LINQ provider. In this case, Entity Framework will ensure those operations are performed inthe database.The following example shows the GridView control modified to allow sorting and paging:<asp:GridViewID="categoriesGrid"runat="server"AutoGenerateColumns="false"AllowSorting="true"AllowPaging="true"PageSize="5"ItemType="WebApplication1.Model.Category"DataKeyNames="CategoryID"SelectMethod="GetCategories"UpdateMethod="UpdateCategory"><Columns><asp:BoundFieldDataField="CategoryID"HeaderText="ID"SortExpression="CategoryID"/><asp:BoundFieldDataField="CategoryName"HeaderText="Name"SortExpression="CategoryName"/>
  • <asp:BoundFieldDataField="Description"HeaderText="Description"/><asp:TemplateFieldHeaderText="# of Products"><ItemTemplate><%# Item.Products.Count%></ItemTemplate></asp:TemplateField></Columns><EmptyDataTemplate>No categories found with a product count of<%# minProductsCount.SelectedValue%></EmptyDataTemplate></asp:GridView>Now when the page runs, the control can make sure that only the current page of data is displayed andthat it’s ordered by the selected column:To filter the returned data, parameters have to be added to the select method. These parameters will bepopulated by the model binding at run time, and you can use them to alter the query before returning thedata.For example, assume that you want to let users filter products by entering a keyword in the query string.You can add a parameter to the method and update the code to use the parameter value:publicIQueryable<Product>GetProducts(string keyword){
  • IQueryable<Product> query = _db.Products;if(!String.IsNullOrWhiteSpace(keyword)){query=query.Where(p =>p.ProductName.Contains(keyword));}return query;}This code includes a Where expression if a value is provided for keyword and then returns the query results.Value providersThe previous example was not specific about where the value for the keyword parameter was coming from.To indicate this information, you can use a parameter attribute. For this example, you can use theQueryStringAttribute class that’s in the System.Web.ModelBinding namespace:publicIQueryable<Product>GetProducts([QueryString]string keyword){IQueryable<Product> query = _db.Products;if(!String.IsNullOrWhiteSpace(keyword))
  • {query=query.Where(p =>p.ProductName.Contains(keyword));}return query;}This instructs model binding to try to bind a value from the query string to the keyword parameter at runtime. (This might involve performing type conversion, although it doesnt in this case.) If a value cannot beprovided and the type is non-nullable, an exception is thrown.The sources of values for these methods are referred to as value providers, and the parameter attributesthat indicate which value provider to use are referred to as value provider attributes. Web Forms will includevalue providers and corresponding attributes for all of the typical sources of user input in a Web Formsapplication, such as the query string, cookies, form values, controls, view state, session state, and profileproperties. You can also write custom value providers.By default, the parameter name is used as the key to find a value in the value provider collection. In theexample, the code will look for a query-string value named keyword (for example,~/default.aspx?keyword=chef). You can specify a custom key by passing it as an argument to the parameterattribute. For example, to use the value of the query-string variable named q, you could do this:publicIQueryable<Product>GetProducts([QueryString("q")]string keyword){IQueryable<Product> query = _db.Products;if(!String.IsNullOrWhiteSpace(keyword))
  • {query=query.Where(p =>p.ProductName.Contains(keyword));}return query;}If this method is in the pages code, users can filter the results by passing a keyword using the query string:Model binding accomplishes many tasks that you would otherwise have to code by hand: reading the value,checking for a null value, attempting to convert it to the appropriate type, checking whether the conversionwas successful, and finally, using the value in the query. Model binding results in far less code and in theability to reuse the functionality throughout your application.Filtering by values from a controlSuppose you want to extend the example to let the user choose a filter value from a drop-down list. Addthe following drop-down list to the markup and configure it to get its data from another method using theSelectMethod property:<asp:Labelrunat="server"AssociatedControlID="categories"Text="Select a category to show products for: "/>
  • <asp:DropDownListrunat="server"ID="categories"SelectMethod="GetCategories"AppendDataBoundItems="true"DataTextField="CategoryName"DataValueField="CategoryID"AutoPostBack="true"><asp:ListItemValue=""Text="- all -"/></asp:DropDownList>Typically you would also add an EmptyDataTemplate element to the GridView control so that the controlwill display a message if no matching products are found:<asp:GridViewID="productsGrid"runat="server"DataKeyNames="ProductID"AllowPaging="true"AllowSorting="true"AutoGenerateColumns="false"SelectMethod="GetProducts"><Columns><asp:BoundFieldDataField="ProductID"HeaderText="ID"/><asp:BoundFieldDataField="ProductName"HeaderText="Name"SortExpression="ProductName"/><asp:BoundFieldDataField="UnitPrice"HeaderText="Unit Price"SortExpression="UnitPrice"/>
  • <asp:BoundFieldDataField="UnitsInStock"HeaderText="# in Stock"SortExpression="UnitsInStock"/></Columns><EmptyDataTemplate>No products matching the filter criteria werefound</EmptyDataTemplate></asp:GridView>In the page code, add the new select method for the drop-down list:publicIQueryable<Category>GetCategories(){return _db.Categories;}Finally, update the GetProducts select method to take a new parameter that contains the ID of the selectedcategory from the drop-down list:publicIQueryable<Product>GetProducts([QueryString("q")]string keyword,[Control("categories")]int?categoryId)
  • {IQueryable<Product> query = _db.Products;if(!String.IsNullOrWhiteSpace(keyword)){query=query.Where(p =>p.ProductName.Contains(keyword));}if(categoryId.HasValue&&categoryId>0){query=query.Where(p =>p.CategoryID==categoryId);}return query;}Now when the page runs, users can select a category from the drop-down list, and the GridView control isautomatically re-bound to show the filtered data. This is possible because model binding tracks the valuesof parameters for select methods and detects whether any parameter value has changed after a postback. Ifso, model binding forces the associated data control to re-bind to the data.
  • HTML Encoded Data-Binding ExpressionsYou can now HTML-encode the result of data-binding expressions. Add a colon (:) to the end of the <%#prefix that marks the data-binding expression:<asp:TemplateFieldHeaderText="Name"><ItemTemplate><%#: Item.Products.Name%></ItemTemplate></asp:TemplateField>Unobtrusive ValidationYou can now configure the built-in validator controls to use unobtrusive JavaScript for client-side validationlogic. This significantly reduces the amount of JavaScript rendered inline in the page markup and reducesthe overall page size. You can configure unobtrusive JavaScript for validator controls in any of these ways:Globally by adding the following setting to the <appSettings> element in the Web.config file:<addname="ValidationSettings:UnobtrusiveValidationMode"value="WebForms"/>Globally by setting the static System.Web.UI.ValidationSettings.UnobtrusiveValidationMode property toUnobtrusiveValidationMode.WebForms (typically in the Application_Start method in the Global.asaxfile).
  • Individually for a page by setting the new UnobtrusiveValidationMode property of the Page class toUnobtrusiveValidationMode.WebForms.HTML5 UpdatesSome improvements have been made to Web Forms server controls to take advantage of new features ofHTML5:The TextMode property of the TextBox control has been updated to support the new HTML5 inputtypes like email, datetime, and so on.The FileUpload control now supports multiple file uploads from browsers that support this HTML5feature.Validator controls now support validating HTML5 input elements.New HTML5 elements that have attributes that represent a URL now support runat="server". As aresult, you can use ASP.NET conventions in URL paths, like the ~ operator to represent the applicationroot (for example, <video runat="server" src="~/myVideo.wmv" />).The UpdatePanel control has been fixed to support posting HTML5 input fields.ASP.NET MVC 4ASP.NET MVC 4 Beta is now included with Visual Studio 11 Beta. ASP.NET MVC is a framework fordeveloping highly testable and maintainable Web applications by leveraging the Model-View-Controller(MVC) pattern. ASP.NET MVC 4 makes it easy to build applications for the mobile Web and includesASP.NET Web API, which helps you build HTTP services that can reach any device. For more information, seethe ASP.NET MVC 4 Release Notes.ASP.NET Web Pages 2New features include the following:New and updated site templates.Adding server-side and client-side validation using the Validation helper.The ability to register scripts using an assets manager.Enabling logins from Facebook and other sites using OAuth and OpenID.Adding maps using the Maps helper.Running Web Pages applications side-by-side.Rendering pages for mobile devices.
  • For more information about these features and full-page code examples, see The Top Features in Web Pages2 Beta.Visual Web Developer 11 BetaThis section provides information about improvements for web development in Visual Web Developer 11Beta and Visual Studio 2012 Release Candidate.Project Sharing Between Visual Studio 2010 and Visual Studio 2012Release Candidate (Project Compatibility)Until Visual Studio 2012 Release Candidate, opening an existing project in a newer version of Visual Studiolaunched the Conversion Wizard. This forced an upgrade of the content (assets) of a project and solution tonew formats that were not backward compatible. Therefore, after the conversion you could not open theproject in the older version of Visual Studio.Many customers have told us that this was not the right approach. In Visual Studio 11 Beta, we now supportsharing projects and solutions with Visual Studio 2010 SP1. This means that if you open a 2010 project inVisual Studio 2012 Release Candidate, you will still be able to open the project in Visual Studio 2010 SP1.Note: A few types of projects cannot be shared between Visual Studio 2010 SP1 and Visual Studio 2012Release Candidate. These include some older projects (such as ASP.NET MVC 2 projects) or projects forspecial purposes (such as Setup projects).When you open a Visual Studio 2010 SP1 Web project for the first time in Visual Studio 11 Beta, thefollowing properties are added to the project file:FileUpgradeFlagsUpgradeBackupLocationOldToolsVersionVisualStudioVersionVSToolsPathFileUpgradeFlags, UpgradeBackupLocation, and OldToolsVersion are used by the process that upgrades theproject file. They have no impact on working with the project in Visual Studio 2010.VisualStudioVersion is a new property used by MSBuild 4.5 that indicates the version of Visual Studio forthe current project. Because this property didn’t exist in MSBuild 4.0 (the version of MSBuild that VisualStudio 2010 SP1 uses), we inject a default value into the project file.
  • The VSToolsPath property is used to determine the correct .targets file to import from the path representedby the MSBuildExtensionsPath32 setting.There are also some changes related to Import elements. These changes are required in order to supportcompatibility between both versions of Visual Studio.Note: If a project is being shared between Visual Studio 2010 SP1 and Visual Studio 11 Beta on twodifferent computers, and if the project includes a local database in the App_Data folder, you must makesure that the version of SQL Server used by the database is installed on both computers.Configuration Changes in ASP.NET 4.5 Website TemplatesThe following changes have been made to the default Web.config file for site that are created using websitetemplates in Visual Studio 2012 Release Candidate:In the <httpRuntime> element, the encoderType attribute is now set by default to use the AntiXSStypes that were added to ASP.NET. For details, see AntiXSS Library.Also in the <httpRuntime> element, the requestValidationMode attribute is set to "4.5". Thismeans that by default, request validation is configured to use deferred ("lazy") validation. For details,see New ASP.NET Request Validation Features.The <modules> element of the <system.webServer> section does not contain arunAllManagedModulesForAllRequests attribute. (Its default value is false.) This means that ifyou are using a version of IIS 7 that has not been updated to SP1, you might have issues with routingin a new site. For more information, see Native Support in IIS 7 for ASP.NET Routing.These changes do not affect existing applications. However, they might represent a difference in behaviorbetween existing websites and new websites that you create for ASP.NET 4.5 using the new templates.Native Support in IIS 7 for ASP.NET RoutingThis is not a change to ASP.NET as such, but a change in templates for new website projects that can affectyou if you are working a version of IIS 7 that has not had the SP1 update applied.In ASP.NET, you can add the following configuration setting to applications in order to support routing:<configuration><system.webServer><modulesrunAllManagedModulesForAllRequests="true">
  • <!-- more --></modules></system.webServer></configuration>When runAllManagedModulesForAllRequests is true, a URL like http://mysite/myapp/home goes toASP.NET, even though there is no .aspx, .mvc, or similar extension on the URL.An update that was made to IIS 7 makes the runAllManagedModulesForAllRequests setting unnecessaryand supports ASP.NET routing natively. (For information about the update, see the Microsoft Support articleAn update is available that enables certain IIS 7.0 or IIS 7.5 handlers to handle requests whose URLs do not end witha period.)If your website is running on IIS 7 and if IIS has been updated, you do not need to setrunAllManagedModulesForAllRequests to true. In fact, setting it to true is not recommended, because itadds unnecessary processing overhead to request. When this setting is true, all requests, including those for.htm, .jpg, and other static files, also go through the ASP.NET request pipeline.If you create a new ASP.NET 4.5 website using the templates that are provided in Visual Studio 2012 RC, theconfiguration for the website does not include the runAllManagedModulesForAllRequests setting. Thismeans that by default the setting is false.If you then run the website on Windows 7 without SP1 installed, IIS 7 will not include the required update.As a consequence, routing will not work and you will see errors. If you have a problem where routing doesnot work, you can do either the following:Update Windows 7 to SP1, which will add the update to IIS 7.Install the update thats described in the Microsoft Support article listed previously.Set runAllManagedModulesForAllRequests to true in that websites Web.config file. Note that thiswill add some overhead to requests.HTML EditorSmart Tasks
  • In Design view, complex properties of server controls often have associated dialog boxes and wizards tomake it easy to set them. For example, you can use a special dialog box to add a data source to a Repeatercontrol or add columns to a GridView control.However, this type of UI help for complex properties has not been available in Source view. Therefore,Visual Studio 11 introduces Smart Tasks for Source view. Smart Tasks are context-aware shortcuts forcommonly used features in the C# and Visual Basic editors.For ASP.NET Web Forms controls, Smart Tasks appear on server tags as a small glyph when the insertionpoint is inside the element:The Smart Task expands when you click the glyph or press CTRL+. (dot), just as in the code editors. It thendisplays shortcuts that are similar to the Smart Tasks in Design view.For example, the Smart Task in the previous illustration shows the GridView Tasks options. If you chooseEdit Columns, the following dialog box is displayed:
  • Filling in the dialog box sets the same properties you can set in Design view. When you click OK, themarkup for the control is updated with the new settings:WAI-ARIA supportWriting accessible websites is becoming increasingly important. The WAI-ARIA accessibility standard defineshow developers should write accessible websites. This standard is now fully supported in Visual Studio.For example, the role attribute now has full IntelliSense:
  • The WAI-ARIA standard also introduces attributes that are prefixed with aria- that let you add semantics toan HTML5 document. Visual Studio also fully supports these aria- attributes:New HTML5 snippetsTo make it faster and easier to write commonly used HTML5 markup, Visual Studio includes a number ofsnippets. An example is the video snippet:To invoke the snippet, press Tab twice when the element is selected in IntelliSense:
  • This produces a snippet that you can customize.Extract to user controlIn large web pages, it can be a good idea to move individual pieces into user controls. This form ofrefactoring can help increase the readability of the page and can simplify the page structure.To make this easier, when you edit Web Forms pages in Source view, you can now select text in a page,right-click it, and then choose Extract to User Control:IntelliSense for code nuggets in attributesVisual Studio has always provided IntelliSense for server-side code nuggets in any page or control. NowVisual Studio includes IntelliSense for code nuggets in HTML attributes as well.
  • This makes it easier to create data-binding expressions:Automatic renaming of matching tag when you rename an opening orclosing tagIf you rename an HTML element (for example, you change a div tag to be a header tag), the correspondingopening or closing tag also changes in real time.This helps avoid the error where you forget to change a closing tag or change the wrong one.Event handler generationVisual Studio now includes features in Source view to help you write event handlers and bind themmanually. If you are editing an event name in Source view, IntelliSense displays <Create New Event>, whichwill create an event handler in the pages code that has the right signature:By default, the event handler will use the controls ID for the name of the event-handling method:
  • The resulting event handler will look like this (in this case, in C#):Smart indentWhen you press Enter while inside an empty HTML element, the editor will put the insertion point in theright place:If you press Enter in this location, the closing tag is moved down and indented to match the opening tag.The insertion point is also indented:Auto-reduce statement completionThe IntelliSense list in Visual Studio now filters based on what you type so that it displays only relevantoptions:IntelliSense also filters based on the title case of the individual words in the IntelliSense list. For example, ifyou type "dl", both dl and asp:DataList are displayed:This feature makes it faster to get statement completion for known elements.JavaScript Editor
  • The JavaScript editor in Visual Studio 2012 Release Candidate is completely new and it greatly improves theexperience of working with JavaScript in Visual Studio.Code outliningOutlining regions are now automatically created for all functions, allowing you to collapse parts of the filethat aren’t pertinent to your current focus.Brace matchingWhen you put the insertion point on an opening or closing brace, the editor highlights the matching one.Go to DefinitionThe Go to Definition command lets you jump to the source for a function or variable.ECMAScript5 supportThe editor supports the new syntax and APIs in ECMAScript5, the latest version of the standard thatdescribes the JavaScript language.DOM IntelliSenseIntelliSense for DOM APIs has been improved, with support for many new HTML5 APIs includingquerySelector, DOM Storage, cross-document messaging, and canvas. DOM IntelliSense is now driven by asingle simple JavaScript file, rather than by a native type library definition. This makes it easy to extend orreplace.VSDOC signature overloadsDetailed IntelliSense comments can now be declared for separate overloads of JavaScript functions by usingthe new <signature> element, as shown in this example:functionGetOrSet(key, value){/// <signature>/// <summary>Gets the value</summary>/// <param name="key" type="String">The key to get the valuefor</param>
  • /// <returns type="String" />/// </signature>/// <signature>/// <summary>Sets the value</summary>/// <param name="key" type="String">The key to set the valuefor</param>/// <param name="value" type="String">The value to set</param>/// <returns type="MyLib" />/// </signature>if(value){values[key]= value;returnthis;}else{return values[key];}}Implicit referencesYou can now add JavaScript files to a central list that will be implicitly included in the list of files that anygiven JavaScript file or block references, meaning you’ll get IntelliSense for its contents. For example, you
  • can add jQuery files to the central list of files, and you’ll get IntelliSense for jQuery functions in anyJavaScript block of file, whether you’ve referenced it explicitly (using /// <reference />) or not.CSS EditorAuto-reduce statement completionThe IntelliSense list for CSS now filters based on the CSS properties and values supported by the selectedschema.IntelliSense also supports title case searches:Hierarchical indentationThe CSS editor uses indentation to display hierarchical rules, which gives you an overview of how thecascading rules are logically organized. In the following example, the #list a selector is a cascading child oflist and is therefore indented.The following example shows more complex inheritance:
  • The indentation of a rule is determined by its parent rules. Hierarchical indentation is enabled by default,but you can disable it the Options dialog box (Tools, Options from the menu bar):CSS hacks support
  • Analysis of hundreds of real-world CSS files shows that CSS hacks are very common, and now Visual Studiosupports the most widely used ones. This support includes IntelliSense and validation of the star (*) andunderscore (_) property hacks:Typical selector hacks are also supported so that hierarchical indentation is maintained even when they areapplied. A typical selector hack used to target Internet Explorer 7 is to prepend a selector with *:first-child +html. Using that rule will maintain the hierarchical indentation:Vendor specific schemas (-moz-, -webkit)CSS3 introduces many properties that have been implemented by different browsers at different times. Thispreviously forced developers to code for specific browsers by using vendor-specific syntax. These browser-specific properties are now included in IntelliSense.
  • Commenting and uncommenting supportYou can now comment and uncomment CSS rules using the same shortcuts that you use in the code editor(Ctrl+K,C to comment and Ctrl+K,U to uncomment).Color pickerIn previous versions of Visual Studio, IntelliSense for color-related attributes consisted of a drop-down listof named color values. That list has been replaced by a full-featured color picker.When you enter a color value, the color picker is displayed automatically and presents a list of previouslyused colors followed by a default color palette. You can select a color using the mouse or the keyboard.The list can be expanded into a complete color picker. The picker lets you control the alpha channel byautomatically converting any color into RGBA when you move the opacity slider:
  • SnippetsSnippets in the CSS editor make it easier and faster to create cross-browser styles. Many CSS3 propertiesthat require browser-specific settings have now been rolled into snippets.CSS snippets support advanced scenarios (like CSS3 media queries) by typing the at-symbol (@), whichshows the IntelliSense list.When you select @media value and press Tab, the CSS editor inserts the following snippet:As with snippets for code, you can create your own CSS snippets.Custom regionsNamed code regions, which are already available in the code editor, are now available for CSS editing. Thislets you easily group related style blocks.
  • When a region is collapsed it displays the name of the region:Page InspectorPage Inspector is a tool that renders a web page (HTML, Web Forms, ASP.NET MVC, or Web Pages) in theVisual Studio IDE and lets you examine both the source code and the resulting output. For ASP.NET pages,Page Inspector lets you determine which server-side code has produced the HTML markup that is renderedto the browser.
  • For more information about Page Inspector, please see the following tutorials:Using Page Inspector in ASP.NET MVCUsing Page Inspector in ASP.NET Web FormsPublishingPublish profilesIn Visual Studio 2010, publishing information for Web application projects is not stored in version controland is not designed for sharing with others. In Visual Studio 2012 Release Candidate, the format of thepublish profile has been changed. It has been made a team artifact, and it is now easy to leverage frombuilds based on MSBuild. Build configuration information is in the Publish dialog box so that you can easilyswitch build configurations before publishing.Publish profiles are stored in the PublishProfiles folder. The location of the folder depends on whatprogramming language you are using:C#: PropertiesPublishProfilesVisual Basic: My ProjectPublishProfilesEach profile is an MSBuild file. During publishing, this file is imported into the projects MSBuild file. InVisual Studio 2010, if you want to make changes to the publish or package process, you have to put your
  • customizations in a file named ProjectName.wpp.targets. This is still supported, but you can now put yourcustomizations in the publish profile itself. That way, the customizations will be used only for that profile.You can now also leverage publish profiles from MSBuild. To do so, use the following command when youbuild the project:msbuild.exe project.csproj/t:WebPublish/p:PublishProfile=ProfileNameThe project.csproj value is the path of the project, and ProfileName is the name of the profile to publish.Alternatively, instead of passing the profile name for the PublishProfile property, you can pass in the fullpath to the publish profile.ASP.NET precompilation and mergeFor Web application projects, Visual Studio 2012 Release Candidate adds an option on the Package/PublishWeb properties page that lets you precompile and merge your sites content when you publish or packagethe project. To see these options, right-click the project in Solution Explorer, choose Properties, and thenchoose the Package/Publish Web property page. The following illustration shows the Precompile thisapplication before publishing option.When this option is selected, Visual Studio precompiles the application whenever you publish or packagethe web application. If you want to control how the site is precompiled or how assemblies are merged, clickthe Advanced button to configure those options.IIS ExpressThe default web server for testing web projects in Visual Studio is now IIS Express. The Visual StudioDevelopment Server is still an option for local web server during development, but IIS Express is now therecommended server. The experience of using IIS Express in Visual Studio 11 Beta is very similar to using itin Visual Studio 2010 SP1.
  • DisclaimerThis is a preliminary document and may be changed substantially prior to final commercial release of thesoftware described herein.The information contained in this document represents the current view of Microsoft Corporation on theissues discussed as of the date of publication. Because Microsoft must respond to changing marketconditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannotguarantee the accuracy of any information presented after the date of publication.This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS,IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rightsunder copyright, no part of this document may be reproduced, stored in or introduced into a retrievalsystem, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, orotherwise), or for any purpose, without the express written permission of Microsoft Corporation.Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual propertyrights covering subject matter in this document. Except as expressly provided in any written licenseagreement from Microsoft, the furnishing of this document does not give you any license to these patents,trademarks, copyrights, or other intellectual property.Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses,logos, people, places and events depicted herein are fictitious, and no association with any real company,organization, product, domain name, email address, logo, person, place or event is intended or should beinferred.© 2012 Microsoft Corporation. All rights reserved.Microsoft and Windows are either registered trademarks or trademarks of Microsoft Corporation in theUnited States and/or other countries.The names of actual companies and products mentioned herein may be the trademarks of their respectiveowners.By Microsoft ASP.NET Team, ASP.NET is a free web framework for building great Web sites and Webapplications using HTML, CSS and JavaScript.
  • Comments (24) RSS FeedYou must be logged in to leave a comment.Show CommentsTable of ContentsLatestASP.NET and Web Tools 2012.2 RoadmapASP.NET and Web Tools 2012.2 Release NotesCustom MVC TemplateFacebook Application Template Tutorial (C#)New Web Optimization Pre-Release Package on NuGetOData support in ASP.NET Web APIASP.NET Web API TracingIntroducing the ASP.NET Web API Help PageWindows Azure AuthenticationASP.NET Web API SamplesASP.NET and Web Tools 2012.2 RCASP.NET MVC Facebook Birthday AppVisual StudioVisual Studio 2012 and .NET Framework 4.5 is RELEASEDVisual Studio 2012 and .NET Framework 4.5 Released to the Web!Visual Studio 2012 HTML Editing FeaturesVisual Studio 2012 CSS EditorVisual Studio 2012 JavaScript EditorVisual Studio 2012 Page InspectorVisual Studio 2012 Web Publishing ImprovementsVisual Studio Express 2012Visual Studio Ultimate 2012HTML Editor / Smart TasksMSDN: Visual Studio 2012ASP.NET
  • ASP.NET 4.5, ASP.NET MVC 4, ASP.NET Web Pages 2, and Visual Studio 2012 for web developersGet the scoop on the ASP.NET 4.5, ASP.NET MVC 4, ASP.NET Web Pages 2, and Visual Studio 11 DeveloperPreviewsWhats New in ASP.NET 4.5 and Visual Studio 2012Whats New in ASP.NET 4.5 LabNew Tools and New Content - ASP.NET, Visual Studio 11 Web and .NET 4.5 Developer Preview (withcommentary)Bundling and OptimizationAsync and AwaitOAuth in the Default ASP.NET 4.5 TemplatesStrongly Typed Data ControlsOAuth/OpenID Support for WebForms, MVC and WebPagesASP.NET and Web Tools 2012.2ASP.NET MVCASP.NET MVCASP.NET MVCASP.NET MVC 4 Mobile FeaturesASP.NET MVC 4 for Visual Studio 2010 SP1ASP.NET MVC Facebook Birthday AppHands On LabsASP.NET Web PagesASP.NET Web PagesTop Features in ASP.NET Web Pages 2ASP.NET Web APIASP.NET Web APIOData support in ASP.NET Web API (Preview)ASP.NET Web API Tracing (Preview)Introducing the ASP.NET Web API Help Page (Preview)ASP.NET Web API Preview SamplesASP.NET Web API Released and a Preview of What’s NextHands On LabsASP.NET Web Forms
  • ASP.NET Web FormsIntroduction and OverviewASP.NET 4.5 Web Forms Model BindingASP.NET 4.5 Web Forms Strong Typed Data ControlsModel Binding #1: Selecting DataModel Binding #2: Filtering DataHands On LabsSignalRSignalR and Web SocketsOWIN and KatanaAn Overview of Project KatanaThis site is managed for Microsoft by Neudesic, LLC. | © 2013 Microsoft. All rights reserved.Privacy Statement|Terms of Use|Site Feedback|Advertise With Us|CMS by UmbracoFollow Us On:Twitter|FacebookMicrosoftFeedback on ASP.NET|File Bugs<a href="" title="Web Analytics"><imgsrc="" height="1" width="1"border="0" alt="" /></a>