ASP.NET
This post is a follow up to to 2 posts: Find/Replace on Render – an MVC alternative to Response Filters and Response.Flush and the crimes against Page Caching. In the first post I explored a way to parse special tags before rendering a page. I’m working on a CMS that accepts special tags inside content. Those tags are then replaced on render. For example, an author might place a tag like: 1: <CustomAmazonBestSellers Count=”5” />
to display the 5 best selling products on Amazon (we don’t support...
It looks like I might be giving a course on Beginning .NET Development to non developers with IT backgrounds. I'm putting together my lectures and it's really hard. I want to make sure that I explain things so others can understand them. Even though this is a .NET course (with a web-based slant), I really see it as a fundamental software development (crash) course. You can’t become a great developer without understanding what’s going on behind the scenes. If you have any thoughts or advice on any of the topics at hand (am I missing a topic? are...
Problem I have a model that uses the State pattern. Some States allow read/write access to the Model’s properties and some are read-only. I wanted a good way to separate the logic for this from my Views; the View shouldn’t have to decide whether properties are displayed as TextBoxes or inside Divs. First Thought At first I was going to create a custom ViewEngine. That ViewEngine would be responsible for choosing the right View – that is, if the View was called “Edit” but the model was in a readonly state, it would change the View to...
UPDATE 02/03/2010: You might NOT want to use this method as it screws up Page Caching: http://blog.statichippo.com/archive/2010/02/03/response.flush-and-the-crimes-against-page-caching.aspx This post is sort of in response to another post of mine entitled Rendering ViewPage to random stream (or not). Back then I was looking for this solution. Now I found it! If you’re not familiar with Response Filters, read the MSDN article and this quick example at aspnetlibrary.com. Basically, Reponse Filters are used to filter output before it gets sent downstream. This is useful if you want to, say, replace certain special characters. Background & the existing Response Filter...
We’re using LINQ-to-SQL (L2S from here on in) for a new project. L2S has a number of drawbacks, and those are especially underscored when working with a very old and severely ‘lagacy’ database. L2S has a 1:1 relationship between tables and objects and a 1:1 relationship between columns and properties. That doesn’t work very well if your database doesn’t map to the business objects you wish you had ;). L2S also has a very tight relationship with your business entities which will make any sort of move away from L2S near impossible the larger your app gets....
We recently had a little dilemma that I’m sure others have had. We have a lot of areas of our pages that are rendered using RenderPartial or RenderAction (part of MVC Futures) and we want graceful handling of exceptions. Of course exceptions shouldn’t happen, but sometimes they do (if only everyone practiced TDD…), and with 1M hits a day we would like to be able to at least show as much content (and ads ;) as we can – even if something does go wrong. ViewEngine & IView So I was approached about this issue and...
Update - I actually seem to have gotten a working solution to this (one I’m comfortable with). I blogged about it here. I had this crazy idea. My company has some Response Filters that replace tokens in the outputted HTML into some other data. Now that we're moving over to MVC I figured hey -- maybe I can do a better job with these. You see, these Filters have inline HTML -- that is, they use a StringBuilder to create the necessary HTML to replace the token. That's no fun -- first of all it's not...
I blogged a while ago about creating a UriModelBinder to bind a url string to a Uri object (see http://blog.statichippo.com/archive/0001/01/01/uri-modelbinders-and-updatemodel.aspx) but things have changed since then (I think that was RC1, but I don't recall). Anyway, here's the same gist updated for the MVC RTM release: 1: public class UriModelBinder : IModelBinder
2: {
3: #region IModelBinder Members
4: public object...
So you're developing an application using ASP.NET MVC and you got a Person class with properties: 1: string FirstName;
2: string LastName;
3: string Email;
4: Uri Webpage;
And of course you have a form that collects these 4 pieces of information. And you build an Action in your PersonController called Create like so:
1: public ActionResult Create(FormCollection form)
...
I was looking for an ASP.NET MVC Captcha control and stumbled upon Nick Berardi's (http://www.coderjournal.com/2008/06/mvc-captcha-for-preview-release-3/). First of all I'm using IIS7 and had trouble getting the HttpHandler to register properly. I ended up with the following steps to get it to work: Add <add verb="GET" path="captcha.ashx" validate="false" type="ManagedFusion.Web.Handlers.CaptchaImageHandler, ManagedFusion.Web.Captcha" /> to <httpHandlers> in Web.config Add <add name="CaptchaImageHandler" verb="GET" path="captcha.ashx" type="ManagedFusion.Web.Handlers.CaptchaImageHandler, ManagedFusion.Web.Captcha" /> to the <handlers> section within <system.webserver> in Web.config Add routes.IgnoreRoute("{handler}.ashx"); to Global.asax So that got it working, but there were...
Full ASP.NET Archive