jquery Programming Glossary: filtercontext
Prevent Caching in ASP.NET MVC for specific actions using an attribute http://stackoverflow.com/questions/10011780/prevent-caching-in-asp-net-mvc-for-specific-actions-using-an-attribute override void OnResultExecuting ResultExecutingContext filterContext filterContext.HttpContext.Response.Cache.SetExpires DateTime.UtcNow.AddDays.. OnResultExecuting ResultExecutingContext filterContext filterContext.HttpContext.Response.Cache.SetExpires DateTime.UtcNow.AddDays.. DateTime.UtcNow.AddDays 1 filterContext.HttpContext.Response.Cache.SetValidUntilExpires false filterContext.HttpContext.Response.Cache.SetRevalidation..
Use ASP.NET MVC validation with jquery ajax? http://stackoverflow.com/questions/14005773/use-asp-net-mvc-validation-with-jquery-ajax override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return.. OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return var modelState filterContext.Controller.ViewData.ModelState.. return var modelState filterContext.Controller.ViewData.ModelState if modelState.IsValid var errorModel..
Detecting IsAjaxRequest() with ASP.NET MVC and JQuery Form Plugin / File Upload http://stackoverflow.com/questions/1681563/detecting-isajaxrequest-with-asp-net-mvc-and-jquery-form-plugin-file-upload override void OnActionExecuting ActionExecutingContext filterContext Verify if a XMLHttpRequest is fired. This can be done by checking.. X Requested With HTTP header. MyController myController filterContext.Controller as MyController if myController null if filterContext.HttpContext.Request.Headers.. as MyController if myController null if filterContext.HttpContext.Request.Headers X Requested With null filterContext.HttpContext.Request.Headers..
How to handle model state errors in ajax-invoked controller action that returns a PartialView http://stackoverflow.com/questions/2261617/how-to-handle-model-state-errors-in-ajax-invoked-controller-action-that-returns IExceptionFilter public void OnException ExceptionContext filterContext if filterContext null throw new ArgumentNullException filterContext.. public void OnException ExceptionContext filterContext if filterContext null throw new ArgumentNullException filterContext if filterContext.Exception.. if filterContext null throw new ArgumentNullException filterContext if filterContext.Exception null typeof ModelStateException..
How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller? http://stackoverflow.com/questions/320291/how-to-post-an-array-of-complex-objects-with-json-jquery-to-asp-net-mvc-control override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.ContentType.Contains application.. OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.ContentType.Contains application json string.. json string inputContent using var sr new StreamReader filterContext.HttpContext.Request.InputStream inputContent sr.ReadToEnd..
ASP.NET MVC Ajax Error handling http://stackoverflow.com/questions/4707755/asp-net-mvc-ajax-error-handling IExceptionFilter public void OnException ExceptionContext filterContext filterContext.ExceptionHandled true filterContext.Result new.. public void OnException ExceptionContext filterContext filterContext.ExceptionHandled true filterContext.Result new JsonResult Data.. filterContext filterContext.ExceptionHandled true filterContext.Result new JsonResult Data new success false error filterContext.Exception.ToString..
Getting properties from JsonResult on the JS side inside jquery ajax http://stackoverflow.com/questions/8249479/getting-properties-from-jsonresult-on-the-js-side-inside-jquery-ajax IExceptionFilter public void OnException ExceptionContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result.. public void OnException ExceptionContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result.. if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result AjaxError filterContext.Exception.Message filterContext..
Prevent Caching in ASP.NET MVC for specific actions using an attribute http://stackoverflow.com/questions/10011780/prevent-caching-in-asp-net-mvc-for-specific-actions-using-an-attribute sealed class NoCacheAttribute ActionFilterAttribute public override void OnResultExecuting ResultExecutingContext filterContext filterContext.HttpContext.Response.Cache.SetExpires DateTime.UtcNow.AddDays 1 filterContext.HttpContext.Response.Cache.SetValidUntilExpires.. NoCacheAttribute ActionFilterAttribute public override void OnResultExecuting ResultExecutingContext filterContext filterContext.HttpContext.Response.Cache.SetExpires DateTime.UtcNow.AddDays 1 filterContext.HttpContext.Response.Cache.SetValidUntilExpires.. ResultExecutingContext filterContext filterContext.HttpContext.Response.Cache.SetExpires DateTime.UtcNow.AddDays 1 filterContext.HttpContext.Response.Cache.SetValidUntilExpires false filterContext.HttpContext.Response.Cache.SetRevalidation HttpCacheRevalidation.AllCaches..
Use ASP.NET MVC validation with jquery ajax? http://stackoverflow.com/questions/14005773/use-asp-net-mvc-validation-with-jquery-ajax public class ValidateAjaxAttribute ActionFilterAttribute public override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return var modelState filterContext.Controller.ViewData.ModelState.. ActionFilterAttribute public override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return var modelState filterContext.Controller.ViewData.ModelState if modelState.IsValid.. ActionExecutingContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return var modelState filterContext.Controller.ViewData.ModelState if modelState.IsValid var errorModel from x in modelState.Keys where modelState x .Errors.Count..
Detecting IsAjaxRequest() with ASP.NET MVC and JQuery Form Plugin / File Upload http://stackoverflow.com/questions/1681563/detecting-isajaxrequest-with-asp-net-mvc-and-jquery-form-plugin-file-upload public class jQueryPartial ActionFilterAttribute public override void OnActionExecuting ActionExecutingContext filterContext Verify if a XMLHttpRequest is fired. This can be done by checking the X Requested With HTTP header. MyController myController.. if a XMLHttpRequest is fired. This can be done by checking the X Requested With HTTP header. MyController myController filterContext.Controller as MyController if myController null if filterContext.HttpContext.Request.Headers X Requested With null filterContext.HttpContext.Request.Headers.. With HTTP header. MyController myController filterContext.Controller as MyController if myController null if filterContext.HttpContext.Request.Headers X Requested With null filterContext.HttpContext.Request.Headers X Requested With XMLHttpRequest..
How to handle model state errors in ajax-invoked controller action that returns a PartialView http://stackoverflow.com/questions/2261617/how-to-handle-model-state-errors-in-ajax-invoked-controller-action-that-returns class HandleModelStateExceptionAttribute FilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext if filterContext null throw new ArgumentNullException filterContext if filterContext.Exception null typeof ModelStateException.. FilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext if filterContext null throw new ArgumentNullException filterContext if filterContext.Exception null typeof ModelStateException .IsInstanceOfType.. public void OnException ExceptionContext filterContext if filterContext null throw new ArgumentNullException filterContext if filterContext.Exception null typeof ModelStateException .IsInstanceOfType filterContext.Exception filterContext.ExceptionHandled..
How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller? http://stackoverflow.com/questions/320291/how-to-post-an-array-of-complex-objects-with-json-jquery-to-asp-net-mvc-control string Param get set public Type JsonDataType get set public override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.ContentType.Contains application json string inputContent using var sr new StreamReader.. set public Type JsonDataType get set public override void OnActionExecuting ActionExecutingContext filterContext if filterContext.HttpContext.Request.ContentType.Contains application json string inputContent using var sr new StreamReader filterContext.HttpContext.Request.InputStream.. application json string inputContent using var sr new StreamReader filterContext.HttpContext.Request.InputStream inputContent sr.ReadToEnd var result JsonConvert.DeserializeObject inputContent JsonDataType..
ASP.NET MVC Ajax Error handling http://stackoverflow.com/questions/4707755/asp-net-mvc-ajax-error-handling public class MyErrorHandlerAttribute FilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext filterContext.ExceptionHandled true filterContext.Result new JsonResult Data new success false error filterContext.Exception.ToString.. class MyErrorHandlerAttribute FilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext filterContext.ExceptionHandled true filterContext.Result new JsonResult Data new success false error filterContext.Exception.ToString.. IExceptionFilter public void OnException ExceptionContext filterContext filterContext.ExceptionHandled true filterContext.Result new JsonResult Data new success false error filterContext.Exception.ToString JsonRequestBehavior JsonRequestBehavior.AllowGet..
Getting properties from JsonResult on the JS side inside jquery ajax http://stackoverflow.com/questions/8249479/getting-properties-from-jsonresult-on-the-js-side-inside-jquery-ajax public class AjaxException ActionFilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result AjaxError filterContext.Exception.Message.. class AjaxException ActionFilterAttribute IExceptionFilter public void OnException ExceptionContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result AjaxError filterContext.Exception.Message filterContext Let.. public void OnException ExceptionContext filterContext if filterContext.HttpContext.Request.IsAjaxRequest return filterContext.Result AjaxError filterContext.Exception.Message filterContext Let the system know that the exception has been handled..
|