Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Portaltemplate code executes on 404 View modes: 
User avatar
Member
Member
Jim - 1/30/2013 8:14:23 AM
   
Portaltemplate code executes on 404
We are in the process of upgrading to v7.0 and I've noticed a difference on when the portaltemplate.aspx executes. In past versions (5.5-6.0), when we received a 404 on an element in the page (a missing image let's say), the portaltemplate code did not execute, however in v7 it does.

We have added some additional code to the portaltemplate.aspx page and code behind that executes for every page. Some of this code relies on sessions and when we get a 404, session is null.

Some questions.
1. Can we get the old functionality back?
2. If not, what's the best way/place to put this code?
3. Leave the code where it is and just check for null on session?

Thanks,

Jim Garwacki

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/1/2013 2:47:38 AM
   
RE:Portaltemplate code executes on 404
Hi,

what do you mean exactly by portaltemplate.aspx execution? When using proper 404 page settings this page should not have been reached ever. It may have been in the documentation - but just as a sample. Also, what custom code are you using?

Best regards,
Juraj Ondrus

User avatar
Member
Member
Jim - 2/1/2013 2:46:09 PM
   
RE:Portaltemplate code executes on 404
That's what I'm saying. The portaltemplate.aspx code is executing even on a request that returns a 404.

I can take my 6.0 code base (which on a 404, portaltemplate.aspx does not execute), upgrade it to 7.0 (fix all the breaking changes) and now the portaltemplate.aspx code executes on 404 return.

The custom code is code we have added to the portaltemplate.aspx page to add various meta, css, js, mobile, etc. Stuff we want added to every page.

I've worked around it by checking if session is null and not accessing it. Basically, it wouldn't be null on a normal page request. But, I don't want to do that if I don't have to.

Thanks,

Jim Garwacki

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/4/2013 7:28:26 AM
   
RE:Portaltemplate code executes on 404
Hi,

so, the 404 page you have is in the content tree and it is using portal engine template, right? If so, the portaltemplate.aspx is its master page and that's why it is called when the 404 portal template page is called.

I think your workaround with the check is correct.

Best regards,
Juraj Ondrus