Cannot redirect after HTTP headers have been sent.

Server Error in '/' Application.

Cannot redirect after HTTP headers have been sent.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Cannot redirect after HTTP headers have been sent.

Source Error:


Line 45: 
Line 46:             Catch ex As Exception
Line 47:                 Response.Redirect("Default.aspx")
Line 48:             End Try
Line 49:     End Sub

Source File: C:\Inetpub\vhosts\mgmt2.pooltrac.com\httpdocs\calendarscheduler\NavBar.ascx.vb    Line: 47

Stack Trace:


[HttpException (0x80004005): Cannot redirect after HTTP headers have been sent.]
   System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) +9873009
   System.Web.HttpResponse.Redirect(String url) +13
   NavBar.Page_Load(Object sender, EventArgs e) in C:\Inetpub\vhosts\mgmt2.pooltrac.com\httpdocs\calendarscheduler\NavBar.ascx.vb:47
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4092.0