How to write pre-render event for asp.net mvc? Actually my issue is that I need to make document standards of my webpage in IE10 to IE9+ standards because by default it is IE7+ standards and my application is not working as per the requirement due to this issue.
            Asked
            
        
        
            Active
            
        
            Viewed 1,432 times
        
    1 Answers
2
            
            
        How to write pre-render event for asp.net mvc?
You can create a simple ActionFilter - Reference taken from here
    public class UpdateFilter : ActionFilterAttribute
    {
        private HtmlTextWriter tw;
        private StringWriter sw;
        private StringBuilder sb;
        private HttpWriter output;
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            sb = new StringBuilder();
            sw = new StringWriter(sb);
            tw = new HtmlTextWriter(sw);
            output = (HttpWriter)filterContext.RequestContext.HttpContext.Response.Output;
            filterContext.RequestContext.HttpContext.Response.Output = tw;
        }
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            string response = sb.ToString();
            output.Write(response);
        }
    }
And when you request a page, you can customize your response html in OnResultExecuted(). When you put a breakpoint, it is going to be like this - 

        Community
        
- 1
 - 1
 
        ramiramilu
        
- 17,044
 - 6
 - 49
 - 66