MVC3 Page - IsPostback like functionality

Might I also suggest you implement it as property in your controller base class like:

protected bool IsPostback 
{
    get { return Request.HttpMethod == "POST"; }
}

-Marc


There's no such think on MVC. You've actions that can handle POSTs, GETs or both. You can filter what each action can handle using [HttpPost] and [HttpGet] attributes.

On MVC, the closest you can get to IsPostBack is something like this within your action:

public ActionResult Index() 
{
    if (Request.HttpMethod == "POST") 
    {
        // Do something
    }

    return View();
}

Therefore,

[HttpPost]
public ActionResult Create(CreateModel model) 
{
    if (Request.HttpMethod == "POST") // <-- always true
    {
        // Do something
    }

    return RedirectToAction("Index");
}