Error on AuthorizationEndpoint redirect
epdubi opened this issue · 2 comments
epdubi commented
- DNN v9.9
- Using Xcillion skin
I'm running into the following error when redirecting to the AuthorizationEndpoint
from AzureClient.cs. Has anyone seen this one before? Any ideas?
2021-04-13 12:56:07,517 [etg65][Thread:16][FATAL] DotNetNuke.Framework.PageBase - An error has occurred while loading page.
System.Web.HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.
at System.Web.HttpResponse.AppendHeader(String name, String value)
at System.Web.HttpResponseWrapper.AddHeader(String name, String value)
at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.GetFormInputElement(HttpContextBase httpContext)
at System.Web.Helpers.AntiForgery.GetHtml()
at DotNetNuke.Framework.ServicesFrameworkImpl.RegisterAjaxAntiForgery(Page page)
at DotNetNuke.Framework.PageBase.OnPreRender(EventArgs e)
at DotNetNuke.Framework.DefaultPage.OnPreRender(EventArgs evt)
at System.Web.UI.Control.<PreRenderRecursiveInternalAsync>d__249.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult()
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()
2021-04-13 12:56:07,548 [etg65][Thread:16][TRACE] DotNetNuke.Web.Common.Internal.DotNetNukeHttpApplication - Dumping all Application Errors
2021-04-13 12:56:07,548 [etg65][Thread:16][FATAL] DotNetNuke.Web.Common.Internal.DotNetNukeHttpApplication - System.Web.HttpException (0x80004005): Error executing child request for /ErrorPage.aspx. ---> System.Web.HttpException (0x80004005): Server cannot set content type after HTTP headers have been sent.
at System.Web.HttpResponse.set_ContentType(String value)
at System.Web.UI.Page.SetIntrinsics(HttpContext context, Boolean allowAsync)
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at System.Web.HttpServerUtility.Transfer(String path)
at DotNetNuke.Framework.PageBase.OnError(EventArgs e)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.<ProcessRequestMainAsync>d__523.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Util.WithinCancellableCallbackTaskAwaitable.WithinCancellableCallbackTaskAwaiter.GetResult()
at System.Web.UI.Page.<ProcessRequestAsync>d__515.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.UI.Page.<ProcessRequestAsync>d__554.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
epdubi commented
Ending the Response by not specifying the Redirect's endResponse
param is working.
HttpContext.Current.Response.Redirect(AuthorizationEndpoint + "?" + parameters.ToNormalizedString());
davidjrh commented
After some tests, the problem was not related to the "false" passed to the redirect method, was the combination of that parameter plus the following line adding a Flush (the flush was causing to set that content after the headers), so the issue was solved by remobing the flush. The "false" parameter remains, otherwise a ThreadAbort exception is recorded caused by the redirect.