I'm not sure this is what you want. But it should work. See below code:
Throttle Attribute
if (!allowExecute)
{
if (String.IsNullOrEmpty(Message))
{
Message = "AllowedRetries Exceeded. You have to wait {n} seconds.";
}
filterContext.HttpContext.Response.StatusCode = (int)HttpStatusCode.Conflict;
var values = new RouteValueDictionary(new
{
action = "Login",
controller = "Account",
exceptiontext = Message.Replace("{n}", Seconds.ToString())
});
filterContext.Result = new RedirectToRouteResult(values);
}
Login Action Method
[HttpGet]
public ActionResult Login(string returnUrl, string exceptiontext)
{
ViewBag.ReturnUrl = returnUrl;
ViewBag.Exceptiontext = exceptiontext;
return View();
}
Update: You don't need to validate if the ViewBag is null.
Login View
//
<div class="panel panel-primary>
<p>@ViewBag.Exceptiontext </p>
</div>
//
The URL should like :
http://localhost:58929/Account/Login?exceptiontext=AllowedRetries%20Exceeded.%20You%20have%20to%20wait%2010%20seconds.