-
|
Donut caching, the ability to cache an entire page except for a small region of the page (or set of regions) has been conspicuously absent from ASP.NET MVC since version 2 . Mmmmm, donuts! – Photo by Pzado at sxc.hu This is something that’s on our Roadmap for ASP.NET MVC 4, but we have yet to flesh out the design. In the meanwhile, there’s a new NuGet package written by Paul Hiles that brings donut caching to ASP.NET MVC 3 . I haven’t tried it myself yet, so be forewarned, but judging by the blog post, Paul has done some extensive research into how output caching works. One issue with his approach is that to create “donut holes”, you need to call an action from within your view. That works for ASP.NET MVC, but not for ASP.NET Web Pages. What...
|
-
|
Recently, a group of covert ninjas within my organization started to investigate what it would take to change our internal build and continuous integration systems (CI) to take advantage of NuGet for many of our products, and I need your input! Hmm, off by one error slays me again. -Image from Ask A Ninja. Click on the image to visit. Ok, they’re not really covert ninjas, that just sounds much cooler than a team of slightly pudgy software developers. Ok, they’ve told me to speak for myself, they’re in great shape! In response to popular demand, we changed our minds and decided to support Semantic Versioning (SemVer) as the means to specify pre-release packages for the next version of NuGet (1.6). In part, this is the cause of the delay for this...
|
-
|
A long while ago I wrote about the potential dangers of Cross-site Request Forgery attacks, also known as CSRF or XSRF. These exploits are a form of confused deputy attack . Screen grab from The Police Academy movie. In that post, I covered how ASP.NET MVC includes a set of anti-forgery helpers to help mitigate such exploits. The helpers include an HTML helper meant to be called in the form that renders a hidden input, and an attribute applied to the controller action to protect. These helpers work great when in a typical HTML form post to an action method scenario. But what if your HTML page posts JSON data to an action instead of posting a form? How do these helpers help in that case? You can try to apply the ValidateAntiForgeryTokenAttribute...
|
-
|
Go that way instead - Photo by JacobEnos CC some rights reserved In an ASP.NET web application, it’s very common to write some jQuery code that makes an HTTP request to some URL (a lightweight service) in order to retrieve some data. That URL might be handled by an ASP.NET MVC controller action, a Web API operation, or even an ASP.NET Web Page or Web Form. If it can return curly brackets, it can be respond to a JavaScript request for JSON. One pain point when hosting lightweight HTTP services on ASP.NET is making a request to a URL that requires authentication. Let’s look at a snippet of jQuery to illustrate what I mean. The following code makes a request to /admin/secret/data . Let’s assume that URL points to an ASP.NET MVC action with the...
|
-
|
NOTE: This blog post covers features in a pre-release product, ASP.NET MVC 4 Developer Preview . You’ll see we call out those two words a lot to cover our butt. The specifics about the feature will change and this post will become out-dated. You’ve been warned. All good recipes call for a significant amount of garlic. Introduction Last week I spoke at the //BUILD conference on building mobile web applications with ASP.NET MVC 4 . In the talk, I demonstrated a recipe I wrote that automates the process to create mobile versions of desktop views. Recipes are a great way to show off your lack of UI design skills like me! In this blog post, I’ll walk through the basic steps to write a recipe. But first, what exactly is a recipe? Obviously I’m not...
|
-
|
If you’re at the BUILD conference in Anaheim, I’ll be speaking in two sessions on Thursday. The first session’s title is a bit of a mouthful. Right now, the Channel 9 link is not up-to-date. Progressively enable the Mobile Web with ASP.NET MVC 4, HTML5 and jQuery Mobile Thursday, 9:00 AM The next generation web is built on HTML5 and JavaScript. You can combine this with jQuery Mobile and give everyone a great experience from tablets to the smallest mobile phone browser. In this session, we’ll see how ASP.NET MVC 4 enables uncompromisingly great experiences on mobile devices when combined with the power of the jQuery Mobile framework. The second talk is a joint talk with Damian Edwards . Building IIS and ASP.NET apps with the power of async Thursday...
|
-
|
EDITOR’S NOTE: Microsoft has an amazing intern program . For a summer, these bright college students work with a feature crew getting real work done, all the while attending cool events nearly every week that, frankly, make the rest of us jealous! Just look at some of the perks listed in this news article! This summer, the ASP.NET MVC is hosting an intern, Stephen Halter, who while very smart, doesn’t have a blog of his own (booo! hiss!). Being the nice guy that I am (and also being amenable to bribes), I’m letting him guest author a post on my blog (first guest post ever!) to talk about the cool project he’s been doing. Hello everyone – my name is Stephen Halter, and I am a summer intern on the ASP.NET MVC team who is excited to show you the...
|
-
|
I hate code samples in technical books! No seriously, this is bile I’m not afraid to give a permalink to (nor am I afraid to end a sentence with a preposition, so there!). Even the shortest code samples are a pain to type in. And if they show anything reasonably interesting, they’re probably too long to type in. Of course, nobody actually types in the sample code, they grab the code from the companion CD (blech!) or download zip files containing the code from the companion website. With Professional ASP.NET MVC 3 ( print edition | kindle edition ) we experimented with a different approach. We made our sample code available as NuGet packages. It seemed fitting given that ASP.NET MVC 3 included NuGet 1.0 as part of the product. The benefit of...
|
-
|
ASP.NET MVC 3 introduced the ability to bind an incoming JSON request to an action method parameter, which is something I wrote about before . For example, suppose you have the following class defined (keeping it really simple here): public class ComicBook { public string Title { get; set; } public int IssueNumber { get; set; } } And you have an action method that accepts an instance of ComicBook: [HttpPost] public ActionResult Update(ComicBook comicBook) { // Do something with ComicBook and return an action result } You can easily post a comic book to that action method using JSON. Under the hood, ASP.NET MVC uses the DefaultModelBinder in combination with the JsonValueProviderFactory to bind that value. A question on an internal mailing list...
|
-
|
In May, we released a tools update for ASP.NET MVC 3 in nine languages other than English . Today I got the good news that ASP.NET MVC 3 documentation is also now available in those nine languages, which arguably is even more helpful to those learning and using ASP.NET MVC. Japanese: http://msdn.microsoft.com/ja-jp/library/gg416514(VS.98).aspx Korean: http://msdn.microsoft.com/ko-kr/library/gg416514(VS.98).aspx Chinese (Simplified): http://msdn.microsoft.com/zh-cn/library/gg416514(VS.98).aspx Chinese (Traditional) http://msdn.microsoft.com/zh-tw/library/gg416514(VS.98).aspx German: http://msdn.microsoft.com/de-de/library/gg416514(VS.98).aspx Spanish: http://msdn.microsoft.com/es-es/library/gg416514(VS.98).aspx French: http://msdn.microsoft.com...
|