I have an MVC application created from the Internet template to use forms authentication, when the user has logged on I want to direct them, say, to the Home|About page.
The LogOn method is that created by the project template, without modification;
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
// etc, etc
}
return View(model);
}
I've set the defaultUrl in Web.config as follows;
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" defaultUrl="~/Home/About"/>
</authentication>
However, when HomeController.LogOn is called the returnUrl parameter is always null. Note the HttpPost attribute on the LogOn method, so the url cannot be passed in the query string.
How can I configure a return url so it gets passed to the LogOn action method and the user is directed to the url's location after log on?