Tag: ASP.NET
All the articles with the tag "ASP.NET".
-
Article on ASP.NET MVC in .NET magazine #21
Yesterday, I received the new Dutch edition of .NET magazine containing my article on the ASP.NET MVC framework. Since the article was written quite a while ago, soucre code is no longer up-to-date. Readers who are interested (or anyone else interested in ASP.NET MVC) can download up-to-date code examples on the ASP.NET MVC guestbook page.
-
Extending ASP.NET MVC OutputCache ActionFilterAttribute - Adding substitution
In my previous blog post on ASP.NET MVC OutputCache, not all aspects of "classic" ASP.NET output caching were covered. For instance, substitution of cached pages. Allow me to explain... When using output caching you might want to have everything cached, except, for example, a user's login name or a time stamp. When caching a full HTTP response, it is not really possible to inject dynamic data. ASP.NET introduced the Substitution control, which allows parts of a cached response to be dynamic. The contents of the Substitution control are dynamically injected after retrieving cached data, by calling a certain static method which returns string data. Now let's build this into my OutputCache ActionFilterAttribute...
-
Creating an ASP.NET MVC OutputCache ActionFilterAttribute
In every web application, there are situations where you want to cache the HTML output of a specific page for a certain amount of time, because underlying data and processing isn't really subject to changes a lot. This cached response is stored in the web server's memory and offers very fast responses because no additional processing is required. Using "classic" ASP.NET, one can use the OutputCache directive on a .aspx page to tell the ASP.NET runtime to cache the response data for a specific amount of time. Optionally, caching may vary by parameter, which results in different cached responses depending on the parameters that were passed in the URL.
-
Code based ASP.NET MVC GridView
Earlier this week a colleague of mine asked me if there was such thing as a DataGrid or GridView or something like that in the ASP.NET MVC framework. My first answer was: "Nope!". I advised him to look for a nice foreach implementation or using ExtJS, Dojo or similar. Which made me think... Why not create a simple GridView extension method which generates a nice looking, plain-HTML grid with all required features like paging, editing, deleting, alternating rows, ...?
-
ASP.NET MVC framework preview 3 released!
Don't know how I do it, but I think this blog post is yet again the first one out there mentioning a new release of the ASP.NET framework (preview 3) The official installation package can be downloaded from the Microsoft site. Source code is also available from CodePlex. Update instructions from preview 2 to preview 3 are contained in the download. If you created a project based on the "preview-preview" version, here's what you'll have to update:
-
Creating a custom ViewEngine for the ASP.NET MVC framework
Have you ever seen a presentation of ScottGu about the ASP.NET MVC framework? There is one particular slide that keeps coming back, stating that every step in the ASP.NET MVC life cycle is pluggable. Let's find out if replacing one of these components is actually easy by creating a custom ViewEngine and corresponding view. After a route has been determined by the route handler, a Controller is fired up. This Controller sets ViewData, which is afterwards passed into the ViewEngine. In short, the ViewEngine processes the view and provides the view with ViewData from the Controller. Here's the base class: [code:c#] public abstract class ViewEngineBase { public abstract void RenderView(ViewContext viewContext); } [/code]
-
ASP.NET MVC custom ActionResult (ImageResult)
The ASP.NET MVC framework introduces the concept of returning an ActionResult in Controllers since the "preview preview" release on CodePlex. The purpose of this concept is to return a generic ActionResult object for each Controller method, allowing different child classes returning different results. An example ActionResult (built-in) is the RenderViewResult. Whenever you want to render a view, you can simply return an object of this class which will render a specific view in its ExecuteResult method. Another example is the HttpRedirectResult which will output an HTTP header (Location: /SomethingElse.aspx).
-
ASP.Net MVC Membership Starter Kit alternative authentication
Last week, I blogged about the ASP.Net MVC Membership Starter Kit and some of its features. Since then, Troy Goode and I are developing at warp-speed to provide a complete (Forms)Authentication starter kit for the MVC framework. Scott Guthrie also noticed our efforts, which forced us to do an official release earlier than planned. Now when I say warp-speed, here's what to think of: we added Visual Studio item templates, a nice setup program, a demo application, ... We started with FormsAuthentication, but we have evolved into some alternatives... You can add a route to the OpenID login action, and have an out-of-the box OpenID login form: Simply enter your OpenID URL, click login. The MVC Membership Starter Kit will handle the rest for you!
-
ASP.Net MVC Membership Starter Kit
Yesterday, I read a cool blog post from Troy Goode about his new CodePlex project MvcMembership. I also noticed his call for help, so I decided to dedicate some of my evening hours to his project. Almost every (ASP.NET) website is using some form of authentication, in most cases based on ASP.NET membership. With this in mind, Troy started an ASP.NET MVC version of this. The current release version provides a sample application containing some membership functionality: After an evening of contributing code, there's additional functionality in the source control system:
-
ASP.NET MVC Framework out on CodePlex
This morning, I was browsing the new projects page on CodePlex and noticed something nice! The ASP.NET MVC team already rumoured around making the ASP.NET MVC framework source code available on CodePlex, but here it is: the ASP.NET MVC project on CodePlex. The CodePlex project does not allow people to make their own contributions, but you can easily look under the hood or fix bugs for your production environment. How cool is that! Happy coding! Update 4:45 PM: Seems like I've stolen the thunder from Scott Guthrie :-) To be complete: the official announcement was made a little bit later than my unofficial announcement. You can read about it here.