Posts

Showing posts from September, 2015

Common Asp.Net Tips and Tricks Part -2

Introduction
In previous series of Asp.Net Tips and Tricks we learn basic configuration for Asp.Net application and exception handling. You can also visit Part-1In this article we learn new tips which is useful for both web form and Asp.Net MVC application. DescriptionIn this article we learn some tips which will helpful while we development. Problem: When we are using Response.Redirect method inside Try Catch Block ThreadAbortException occurs Solution 1: Response.Redirect(“redirectUrl”,false);

This method stops current execution of request and error is prevented.

Solution 2: Second way to prevent ThreadAbortException error is to handle error in try catch block
try { Response.Redirect(“redirectToSomeUrl”); } catch(ThreadAbortException e) { }
Problem:Server cannot set status after HTTP headers have been sent

Solution: This error occurs with number of reason in Asp.Net MVC application
When we use export to excel or any other format of export this type of error occurs t…