1

As someone relearning .net + Web API 2, I'm unsure what these entries in my Web.config file are for. Should requirePermission be set to true? Are there any tutorials about this. (I'm currently piecing together the whole process of .net+webapi+azure emulator+ deploying to the cloud).

 <configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.1.1.0, Culture=neutral, PublicKeyToken=XXXXXXXXX">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXX" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXX" requirePermission="false" />
    </sectionGroup>
  </configSections>
David van Dugteren
  • 3,879
  • 9
  • 33
  • 48
  • my be answer is [here](http://msdn.microsoft.com/en-us/library/vstudio/ms228114(v=vs.100).aspx)? – Zafar Mar 11 '14 at 19:44

1 Answers1

2

What is <configSections>?

The <configSections> element defines configuration elements that you'll fill out later. For example, this line:

<section
   name="pages"
   type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, ..."
   requirePermission="false"
/>

...means that further down in your configuration file, you define a <pages> section internally handled by RazorPagesSection. The requirePermission attribute is related to trust-level security, and you don't need to worry about it unless your app runs in partial-trust scenarios (e.g. on a traditional shared host).

This is boilerplate configuration — it's auto-configured and you generally don't need to change it unless something goes wrong.

What are Razor, <pages>, and <host>?

These sections configure Razor, which is the new syntax used in ASP.NET MVC views. The default values are fine when you're starting out.

The <pages> element configures your MVC views — you can configure which namespaces are referenced by default and add or override the helper methods available in your views.

The <host> element configures how your application is served. The only property is factoryType, which I think tells the server how to build your views. You never need to change this unless you're doing something particularly fancy.

Community
  • 1
  • 1
Pathoschild
  • 4,636
  • 2
  • 23
  • 25