Home / ASP.NET Weblogs

Latest Microsoft Blogs

Browse by Tags

Related Posts

  • ASP.NET Web API Released and a Preview of What’s Next

    Today we announced the release of Visual Studio 2012 and .NET 4.5 which of course includes ASP.NET Web API . There is a ton of new features in VS 2012 and I highly recommend checking out the videos by Scott Hanselman demonstrating a broad set of features of VS 2012 and .NET 4.5. In addition to shipping as part of Visual Studio 2012 you can also download Web API for Visual Studio 2010 as a standalone installer and as always, you can find us in our Open Source home on codeplex where you can see the source, contribute pull requests, and log issues. Further, you can find a bunch of ASP.NET Web API and HttpClient samples demonstrating many of the features. The samples also live on codeplex so that you can download them and work with them . Here you...


  • HttpClient, HttpClientHandler, and WebRequestHandler Explained

    In two previous blogs I describe how to use HttpClient as well as how to use the HttpMessageHandler pipeline . What we haven’t done explicitly is showing when and how to use HttpClient , HttpClientHandler , and WebRequestHandler . This is the purpose of this blog. The first thing to remember is that HttpClient sits on top of HttpWebRequest which has a lot of properties for controlling how to deal with requests and responses. However, in order to stay simple, HttpClient doesn’t expose all these properties up front – it would make it unwieldy and show a lot of things that are rarely used. However, if you need to access these properties then there are two ways of doing it: use either HttpClientHandler or WebRequestHandler. Both are HttpMessageHandlers...


  • ASP.NET Web API Samples on Codeplex

    If you are interested in samples for ASP.NET Web API and HttpClient then please check out our new git repository on aspnet.codeplex.com . Here you will find an initial set of samples written in C# showing various features of ASP.NET Web API and HttpClient. The set is only the beginning. We are very interested in getting your feedback and suggestions for how to improve the samples and what features you would to see. Should the format be different? Should they be documented in other ways? Please let us know by registering issues ! Prerequisites The samples are split into two parts: those that target .Net 4 and those that target .Net 4.5. The latter use the async/await keywords introduced in Visual Studio 2012 which makes programming with asynchronous...


  • Performance Implications of Bundling and Minification on Web Browsing

    In this blog we analyze the impact of bundling, minification , compression, and pipelining on HTTP performance and in particular the impact on traditional browser scenarios. First we look at the impact of bundling and minification on the content in terms of size. Then we look at the impact of bundling and minification on download and page layout times in a browser-style application. The purpose is to get a handle on what kind of performance gains can be achieved with a modern HTTP/1.1 implementation when combined with efficient organization of content. The results presented show that only when content and protocol work together is it possible to get significantly faster performance. Just looking at the protocol alone is not sufficient. The data...


  • ASP.NET Web API Updates – May 14

    We have been on a roll with respect to changes over the last few weeks – here’s some of the highlights. If you want to see the full list then you can either track the commit page or follow the project which will then show you the updates on your codeplex home page . As in the previous update this is a sneak-peak of code checked into our CodePlex source code repository but not yet released as part of our official installer . See Using Nightly ASP.NET Web Stack NuGet Packages for how to try out these features. Per Controller Type Configuration ASP.NET Web API has a HttpConfiguration object that provides configuration for features including routing, dependency resolution, media type formatters, and message handlers. However, while the HttpConfiguration...


  • ASP.NET Web API Updates – May 3

    Some interesting updates were checked in over the last week. As in the previous update this is a sneak-peak of code checked into our CodePlex source code repository but hasn’t yet been released as part of our official installer . See Using Nightly ASP.NET Web Stack NuGet Packages for how to try out these features. Per-Route Message Handlers Support for per-route message handlers has been a popular request on our issues list . The issue is that HttpMessageHandlers is a flexible extensibility point for dealing with HTTP requests and responses but they are configured once per application within the HttpConfiguration . In some scenarios you have different needs for different services so a more flexible registration is needed. Brad Wilson describes...


  • Async Mashups using ASP.NET Web API

    This blog shows an example of how to build an ASP.NET Web API ApiController that asynchronously talks to multiple other Web APIs in parallel without blocking a thread on the server. Btw, if you have detected a certain theme in these blogs around using Tasks with ASP.NET Web API then you are indeed on to something :) Asynchronous programming is an important part of building scalable, robust, and responsive Web applications regardless of whether on client side or server side. Asynchronous programming has traditionally been very complicated leaving it to only the most dedicated to implement it but with the new Task model even complex patterns such as dealing with multiple asynchronous requests in parallel are manageable without braking too much...


  • Asynchronous File Upload using ASP.NET Web API

    HTML Form File upload (defined in RFC 1867 ) is a classic mechanism for uploading content to a Web server and is supported by all browsers that I am aware of. This blog shows how to handle Form File Upload in ASP.NET Web API asynchronously using the Task-based pattern introduced in .NET 4 and enhanced in .NET 4.5. Using ASP.NET Web API you can upload files of any size when self hosted (well, up to System.Int64.MaxValue which in practice is “any size”). ASP.NET has a maximum limit of 2G in terms of file size that you can upload. What is HTML File Upload? Let’s first remind ourselves what HTML File Upload is. If you don’t need to brush up on HTML file upload then you can just skip to the next section… You enable support for HTML File Upload in...


  • Async Streaming in ASP.NET Web API

    ASP.NET Web API supports asynchronous actions using the new Task-based programming model introduced in .NET 4. In .NET 4.5 the model has improved further and in addition is supported directly from C# using the new async and await keywords (see “ Visual Studio Asynchronous Programming ” for background). What this means is that you can have actions that look like this: 1: public Task< string []> GetContent( string topic) 2: { 3: ... 4: } as well as 1: public Task<HttpResponseMessage> GetContent( string topic) 2: { 3: ... 4: } and even this 1: public Task GetContent( string topic) 2: { 3: ... 4: } The benefit of writing Task-based actions is that you don’t block a thread on the server even if things take a long time to complete and...


  • Using ASP.NET Web API with ASP.NET Web Forms

    Several of the ASP.NET Web API tutorials (see for example “Your First ASP.NET Web API” ) show how you can use ASP.NET Web API with MVC applications. However, you can equally well add a Web API to a Web Forms enabling the same Web API support as in MVC applications. To show how you do this, let’s build a Web Site from scratch and then add a Web API to it. We use the Visual Web Developer 2010 Express version of Visual Studio with ASP.NET Web API Beta installed. First we create a new ASP.NET Empty Web Site and give it a reasonable name: Then we add an ASP.NET Folder to hold our Web API implementation. We do this by adding a an App_Code folder as follows: Next we add a Web API Controller Class within the App_Code folder using Add New Item . Note...


Page 1 of 6 (57 items) 1 2 3 4 5 Next > ... Last »

Archives