Skip to content

Commit e109652

Browse files
dimarobertbdukes
authored andcommitted
Fix unreliable DnnMvcHandler.DisableMvcResponseHeader
1 parent 482d741 commit e109652

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

DNN Platform/DotNetNuke.Web.Mvc/DnnMvcHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private ModuleRequestContext GetModuleRequestContext(HttpContextBase httpContext
130130
{
131131
HttpContext = httpContext,
132132
ModuleContext = moduleContext,
133-
ModuleApplication = new ModuleApplication(this.RequestContext, DisableMvcResponseHeader)
133+
ModuleApplication = new ModuleApplication(this.RequestContext)
134134
{
135135
ModuleName = desktopModule.ModuleName,
136136
FolderPath = desktopModule.FolderName,

DNN Platform/DotNetNuke.Web.Mvc/Framework/Modules/ModuleApplication.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,23 @@ public class ModuleApplication
3232
private bool initialized;
3333

3434
public ModuleApplication()
35-
: this(null, false)
35+
: this(null)
3636
{
3737
}
3838

3939
public ModuleApplication(bool disableMvcResponseHeader)
40-
: this(null, disableMvcResponseHeader)
40+
: this(null)
4141
{
4242
}
4343

4444
public ModuleApplication(RequestContext requestContext, bool disableMvcResponseHeader)
45+
: this(requestContext)
4546
{
46-
this.RequestContext = requestContext;
47+
}
4748

48-
DisableMvcResponseHeader = disableMvcResponseHeader;
49+
public ModuleApplication(RequestContext requestContext)
50+
{
51+
this.RequestContext = requestContext;
4952

5053
// ReSharper disable once DoNotCallOverridableMethodsInConstructor
5154
this.ControllerFactory = Globals.GetCurrentServiceProvider().GetRequiredService<IControllerFactory>();
@@ -70,8 +73,6 @@ public ModuleApplication(RequestContext requestContext, bool disableMvcResponseH
7073

7174
public ViewEngineCollection ViewEngines { get; set; }
7275

73-
private static bool DisableMvcResponseHeader { get; set; }
74-
7576
public virtual ModuleRequestResult ExecuteRequest(ModuleRequestContext context)
7677
{
7778
this.EnsureInitialized();
@@ -164,7 +165,7 @@ protected internal virtual void Init()
164165

165166
protected internal virtual void AddVersionHeader(HttpContextBase httpContext)
166167
{
167-
if (!DisableMvcResponseHeader)
168+
if (!DnnMvcHandler.DisableMvcResponseHeader)
168169
{
169170
httpContext.Response.AppendHeader(MvcVersionHeaderName, MvcVersion);
170171
}

0 commit comments

Comments
 (0)