November Happy Hour will be moved to Thursday December 5th.

Null currentPage in Index action of page

Vote:
 

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.
#205297
Jul 04, 2019 13:31
Vote:
 

Please follow the below article to create a new page.

https://roland.kierkels.net/2014/10/creating-your-first-pages-and-blocks-in-episerver/

Thanks

Ravindra

#205300
Jul 04, 2019 13:59
Vote:
 

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).

Thanks

#205316
Jul 05, 2019 3:49
Vote:
 

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.

#205318
Jul 05, 2019 4:12
Vote:
 

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" />
</httpErrors>

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.

https://github.com/Geta/404handler#custom-404-page

Thanks

#205319
Edited, Jul 05, 2019 4:32
Vote:
 

Hi Muller,

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

For more info refer below article-

http://www.jondjones.com/learn-episerver-cms/episerver-developers-guide/episerver-modules/episerver-7-installing-bvn404handler-for-an-mvc-project

https://ericceric.com/2018/10/14/create-a-custom-404-page-with-bvn/

Thanks

Ravindra

#205321
Jul 05, 2019 8:58
Vote:
 

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?

#205328
Jul 05, 2019 11:14
Vote:
 

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.

#205350
Jul 07, 2019 13:18
Vote:
 

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.

#205372
Jul 09, 2019 12:21
Vote:
 

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.

Thanks

#205373
Jul 09, 2019 12:26
Vote:
 

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.

#205390
Edited, Jul 09, 2019 15:04
Vote:
 

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

https://world.episerver.com/forum/legacy-forums/Episerver-7-CMS/Thread-Container/2013/3/Custom-404-page-in-EPi-7-MVC/

Let me know if it helps.

Thanks

#205393
Jul 09, 2019 15:10
Vote:
 

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).

#205398
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.