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 16:                 if (!(this.Page.Request.Url.AbsoluteUri.Contains("www.")))
Line 17:                 {
Line 18:                     Response.Redirect(this.Page.Request.Url.AbsoluteUri.Replace("http://perfectgame.org", "https://www.perfectgame.org"));
Line 19:                 }
Line 20:                 else

Source File: c:\inetpub\wwwroot\PerfectGame\MasterGeneralBS.master.cs    Line: 18

Stack Trace:


[HttpException (0x80004005): Cannot redirect after HTTP headers have been sent.]
   System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) +9711284
   System.Web.HttpResponse.Redirect(String url) +8
   MasterGeneralBS.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\PerfectGame\MasterGeneralBS.master.cs:18
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Control.LoadRecursive() +145
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772


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