U4-3666 - Deleting /Views/web.config generated new file with missing

Created by Mikael Syska 21 Nov 2013, 22:19:46 Updated by Shannon Deminick 26 Nov 2013, 09:03:31

This is the web.config generated:

<system.web>

<!--
    Enabling request validation in view pages would cause validation to occur
    after the input has already been processed by the controller. By default
    MVC performs request validation before a controller processes the input.
    To change this behavior apply the ValidateInputAttribute to a
    controller or action.
-->
<pages
    validateRequest="false"
    pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
    userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <controls>
    <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
  </controls>
</pages>

</system.web>

<system.webServer>

<handlers>
  <remove name="BlockViewHandler"/>
  <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>

</system.webServer>

Missing this part:

Comments

Sebastiaan Janssen 22 Nov 2013, 08:28:51

Steps to reproduce please? Works fine for me.


Mikael Syska 22 Nov 2013, 09:26:46

Steps to reproduce:

  • Start VS 2012
  • Create a new Empty Web Project.
  • Install UmbracoCms via NuGet.
  • Start the installer, use embedded DB.
  • Create a DocType including a Template.
  • Create a root content node, publish.
  • Delete the web.config in the Views folder.
  • A web.config" gets created: http://screencast.com/t/yUwxzBaJhD88


Sebastiaan Janssen 22 Nov 2013, 10:14:14

Why would you delete the web.config file from the views folder??

Assigning to Shannon as it's writing the wrong web.config file to the views folder, not sure where that code would live.


Mikael Syska 22 Nov 2013, 10:19:49

It all started from a previous bug, when the installer did not add the correct "web.config" to the Views folder for some reason when installing from NuGet in VS 2013 into an Empty Web Project.

But no ... I would not delete, but I think we might just as well have it fixed now. I don't have 2013 at this computer so not sure if it's still an issue in 2013. But I will test it later today.


Sebastiaan Janssen 22 Nov 2013, 10:27:39

It's an issue with any VS as it's our code that writes the web.config file.


Mikael Syska 22 Nov 2013, 10:30:57

That's what makes it very odd since it's correct when installing but wrong when it's done at runtime of the website. I think someone mentioned that it was done by the ViewEngine if it's missing.


Sebastiaan Janssen 22 Nov 2013, 10:39:51

When it's installing it just uses a file in the NuGet package. When recreating it uses some code to write a new file, so it's not odd that those files wouldn't match up as it's two completely separate things.


Shannon Deminick 25 Nov 2013, 01:14:12

It's true, the umbraco view engine will create this file if it doesn't exist. Perhaps this is part of the issue? The reason it did this was when we first released 4.10 with MVC so when people upgraded it would be seamless (no config changes).

The code that does this is in Umbraco.Web.Mvc.RenderViewEngine.EnsureFoldersAndFiles

The web.config it writes out is in:

Umbraco.Web.Mvc.Strings.web_config resource (found at this proj location - Umbraco.Web.Mvc.web.config.templates)


Shannon Deminick 26 Nov 2013, 06:10:46

confirmed, the gen'd config is old :(

I'm just going to remove the generated config since we don't have to worry about it since we ship with it.


Shannon Deminick 26 Nov 2013, 06:13:19

Actually... now I realize another reason why we had this, it's to also ensure that a correct web.config is generated in any ~/App_Plugins/MyPackage/Views folder if package devs forget to ship it. I'll just make sure the gen'd one is correct.


Sebastiaan Janssen 26 Nov 2013, 08:49:40

How can we make sure it's always up-to-date? One single source of the truth please.


Shannon Deminick 26 Nov 2013, 08:58:43

yes, will do


Shannon Deminick 26 Nov 2013, 08:59:41

actually sorry, i cannot do that. that is impossible because they exist in different projects. So either we don't ship with this web.config and rely on having it generated every time or we remove the generation, or we have it duplicated.


Shannon Deminick 26 Nov 2013, 09:00:28

I guess the other option is to have a shared asset (linked file), that might work.


Shannon Deminick 26 Nov 2013, 09:03:31

that worked, 2391ee1368762eacfe27795a07a73014fcf1a54e


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.0.0

Due in version: 7.0.1

Sprint:

Story Points:

Cycle: