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 50:                    if (!User.Identity.IsAuthenticated)
Line 51:                     {
Line 52:                         Response.Redirect("~/Login");
Line 53:                     }
Line 54:                     else

Source File: d:\Website\telecaretoday.com\WWW\Views\MyAccount\Index.aspx    Line: 52

Stack Trace:


[HttpException (0x80004005): Cannot redirect after HTTP headers have been sent.]
   System.Web.HttpResponse.Redirect(String url, Boolean endResponse) +11171762
   ASP.views_myaccount_index_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer) in d:\Website\telecaretoday.com\WWW\Views\MyAccount\Index.aspx:52
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
   ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in d:\Website\telecaretoday.com\WWW\Views\Shared\Site.Master:337
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
   System.Web.UI.Page.Render(HtmlTextWriter writer) +38
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +89
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4240


Version Information: Microsoft .NET Framework Version:2.0.50727.8009; ASP.NET Version:2.0.50727.8015