.NET, Archive, ASP.NET

Handling Unknown Controller Actions In ASP.NET MVC

In my last article I discussed how to use a wild card route to capture completely malformed URLs. But what if a URL matches to a controller in which the requested action cannot be found?

For example, when a visitor requests http://example.com/product/listing when there is no listing action on the product controller. In this example your visitor would be greeted by the a less than friendly page stating:

Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. read more

Archive, ASP.NET, C#

Friendly 404 Errors In ASP.NET MVC

Custom file not found (404) error pages can help to create a more rewarding user experience for your site visitors. Links become outdated and there is nothing more frustrating for a user than to have found a link to exactly what they are looking for and to come across the infamous “file not found” screen. read more

Archive, ASP.NET

Enabling Session State In IHttpHandlers

Jason / February 25, 2008

Sometimes it is handy to have the HttpSession available from your custom IHttpHandlers. By default the session state is unavailable from IHttpHandlers, and attempting to access it will result in a NullReferenceException. To make session state available simply implement the IRequireSessionState interface.

using System.Web; using System.Web.SessionState; public class SomeHandler : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context){ //do processing that requires session state. //use the context.Session to acquire the session state. } public bool IsReusable { get { return false; } } } read more

.NET, Archive, ASP.NET


Jason / February 23, 2008

Manning has now announced the early access available of the book ASP.NET MVC In Action through their MEAP program.

The title is scheduled to be published in October of 2008, but through the early access program you can start reading the chapters as the authors write them. This particular book looks promising as it will provided a pragmatic explanation of MVC tailored towards ASP.NET developers. read more

Archive, ASP.NET

Getting Started With ASP.NET MVC

Jason / February 19, 2008

For seasoned ASP.NET developers, with the advent of true MVC support in ASP.NET, it may a little confusing of how and where to start.

For starters what is MVC, and what does it have to do with ASP.NET?

MVC is a software pattern for the UI tier, most popularly used in website development. MVC is an acronym for Model-View-Control which happens to be the three core concepts of the MVC pattern. read more

Archive, ASP.NET

Comments In ASP.NET

Jason / December 22, 2007

Comments in HTML come in handy to temporarily remove site content. As ASP.NET developers, we have HTML comments available to use. In any ASPX markup file you can simply use the comment notation. read more

Archive, ASP.NET

Runat Server

Jason / December 20, 2007

As an ASP.NET developer you have undoubtedly seen controls with their runat property set to the value server. Other than being a required property, what does that property really mean? read more

Archive, ASP.NET

Validating Drop Downs In ASP.NET – Part 1

Jason / December 19, 2007

User input validation is an important component in any user interface. In the realm of web development a response UI is extremely important to the users experience.

If you are like myself, programming in JavaScript does not come easily to you. Fortunately, ASP.NET contains several validator controls that allow for client side form validation without you having to program any JavaScript.

Take for example a simple drop down control.

<asp:DropDownList ID="ddlSampleDropDown" runat="server"> <asp:ListItem Value="">--please select one--</asp:ListItem> <asp:ListItem Value="1">Apples</asp:ListItem> <asp:ListItem Value="2">oranges</asp:ListItem> </asp:DropDownList> read more