aspdotnet_change_default_razorpage_root.md - brainchildservices/curriculum GitHub Wiki

SLIDE-1

Changing the default Razor Pages root folder.

SLIDE-2

You can use configuration to change the root folder for Razor pages. The following example changes the root folder from the default Pages to Content:

  public void ConfigureServices(IServiceCollection services)
  {
     services.AddRazorPages()
     .AddRazorPagesOptions(options => {
     options.RootDirectory = "/Content";
     });
  }

SLIDE-2(DOWNWARDS)

Or you can use the WithRazorPagesRoot extension method:

  public void ConfigureServices(IServiceCollection services)
  {
      services.AddRazorPages().WithRazorPagesRoot("/Content");
  }

Note that you cannot change the root folder for pages located in areas. [in slidedeck highlight this line with any color]