Redirect to an action from Application_BeginRequest in global.asax
All above will not work you will be in the loop of executing the method Application_BeginRequest. You need to use HttpContext.Current.RewritePath(“Home/About”);
All above will not work you will be in the loop of executing the method Application_BeginRequest. You need to use HttpContext.Current.RewritePath(“Home/About”);
I believe the way the ValidationSummary flag works is it will only display ModelErrors for string.empty as the key. Otherwise it is assumed it is a property error. The custom error you’re adding has the key ‘error’ so it will not display in when you call ValidationSummary(true). You need to add your custom error message … Read more
I eventually stumbled upon an example of the usage I was looking for – to assign an error to the Model in general, rather than one of it’s properties, as usual you call: ModelState.AddModelError(string key, string errorMessage); but use an empty string for the key: ModelState.AddModelError(string.Empty, “There is something wrong with Foo.”); The error message … Read more