Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Null currentPage in Index action of page


I am getting null currentPage in Index action of a page. I have added EPiServer route as well. My controller is inherited from 

PageController<MyPage> and index gets hit but with null currentPage.
Jul 04, 2019 13:31

Please follow the below article to create a new page.



Jul 04, 2019 13:59

Hi Muller,

Please explain full scenario that what are you doing with your page? Are you just accessing it? Or, please make sure you are not changing or altering the defult inheritance (PageData)?

Or anything else if you are doing with your page (if applicable).


Jul 05, 2019 3:49

I am implementing 404 page not found feature. I have configured in webconfig, created pages from CMS as well. But when controller action is called, currentPage is null.

Jul 05, 2019 4:12

So if you are accessing 404 page, here is configuration

<httpErrors errorMode="Custom" existingResponse="Auto">
      <remove statusCode="404" />
      <error statusCode="404" path="/404" responseMode="ExecuteURL" />

The "/404" is the page that should hit when you get 404 status. This is a page created with page type inherited with PageData.

Let me know if you are using same type of configuration. And, have you tried accessing it directly (http://mysite/404), without tring generating 404 status in site?

Here is the reference for more information.


Edited, Jul 05, 2019 4:32

Hi Muller,

If you want to implement the 404 in your project then just use the BVN.404Handler

For more info refer below article-



Jul 05, 2019 8:58

It kind of sounds that you're trying to call the page via its MVC route, rather than its Episerver route. Have you tried accessing the page via the View on website feature?

Jul 05, 2019 11:14

Andreas is right.

This typically happens when you invoke the controller at the default MVC route. E.g. /account/ when you have an AccountController, and the default MVC route is registered.

If you also have an Episerver page with the name, Account, the Episerver page and the default route can collide. A default MVC route would usually be needed only for a few specific controllers.

Try to remove the default route and add specific routes to those controllers instead.

Jul 07, 2019 13:18

When I click view on website, it opens as it has url with proper page name like http://localhost:55019/en/error-handler-page/. But when I enter http://localhost:55019/en/asdf with not proper url, currenPage is null.

Jul 09, 2019 12:21

Hey Muller,

For 404 configuration, are you using any module (like BVN.404Handler) or manual configuration? And, have you configured any partial router?

If you are using custom module then please check the configuration.


Jul 09, 2019 12:26

Hi Praful,

I am not using any module; only the settings in config as mentioned above. When I use url like  http://localhost:55019/en/asdf how does routing directs it to my errorhandler controller? Like I mentioned above when I have proper page name, it works. But that is not what 404 page meant for.

Edited, Jul 09, 2019 15:04

Here is the related forum for custom 404 page setup with Episerver

Let me know if it helps.


Jul 09, 2019 15:10

Hi Muller

It sounds like wrong URLs are not redirected to the actual CMS page (/en/error-handler-page/).

If you make such configurations in web.config, without any plugin, the configuration needs to point to that CMS page URL (choose a single language version).

Jul 09, 2019 15:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.