Tag Archives: mvc

Build a FlashMessenger system in ASP.NET MVC

Posted on in Development, How-Tos, Windows

Build a FlashMessenger system in ASP.NET MVC

Usually, I’m using PHP for web projects, but currently I’m working on an application using ASP.NET’s MVC framework. In many frameworks (e.g. Zend Framework or CakePHP) there is some kind of messaging system (flash messages), which allows to save a message to the session and to display it on the next request. This is useful in many situations, but mostly used after saving forms. So for example you recieve a POST request to create a new record, you save the record, redirect the user to the overview page and inform him about successful creation through a flash message which you saved before doing the redirect. As I didn’t find a way how to achieve this in ASP.NET MVC, I started to build an own solution. The result is a combination of a base controller, an action filter and a flashmessenger object which is stored in the session. Please note that I’m not too familiar neither with ASP.NET nor with C#/.NET in general, so if there are things to improve please feel free to correct me.

Continue reading →

Disable layout and view renderer in Zend Framework

Posted on in Development

Just a quick tip: I’m working on a project using Zend Framework and needed to switch off layout and view renderer for a specific controller. This can be achieved by adding the following calls to the controller’s preDispatch() method:

public function preDispatch()
{
    $this->_helper->layout()->disableLayout();
    $this->_helper->viewRenderer->setNoRender(true);
}