Custom .ASPX pages in Portal Mode

Eric Garrison asked on January 23, 2018 15:45

What is the best practice to add custom .ASPX pages to a site that is running in Portal Mode. The site is on a stand alone instance of Kentico 11. It needs a very robust enhancement that will entail 5-15 custom .ASPX pages. These are functions that will require lots of Insert/Update/Delete of SQL data, custom handling. We don't feel comfortable doing it as a webpart and inserting into Portal engine. The issue is that we also need the full stack of session information. UserID, Login status, etc. Then we also would like to wrapper the ASPX with an existing master page.

Is there any documentation or examples of how to setup and do this?

Recent Answers

Dragoljub Ilic answered on January 23, 2018 16:10 (last edited on January 23, 2018 16:11)

Hi Eric,

If I understand you correctly, you want to add new .aspx page in kentico interface (backend)? If that is the case, you can create new simple .aspx page in kentico which will inherit 'CMSPage' or any other that satisfy your requirements. After that you can simply create new custom module without any classes and connect your page on UI tab by using type 'URL' and target url will be path to your page (starting with ~/CMSModules/...).

You can find more about creating a custom module on this link.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 23, 2018 16:15

You can have them both (portal and aspx) but if you want to have a wrapper for the master page, then your site's master page needs to be an aspx page as well and not the out of the box portal master page.

You can very well perform all the CRUD activities using a webpart as well as set/get Session, User and Login info. FWIW, I'd go the webpart route vs. having to change the whole site up. Your custom webpart(s) may only ever be used on one page but who cares, it gets done what you need and allows you to configure it if you so need vs. a page template is hard coded and cannot be configured unless you re-write the code.

0 votesVote for this answer Mark as a Correct answer

Eric Garrison answered on January 23, 2018 17:08

Brenden - The process needs to be a multi step process. Basically a wizard where they perform multiple steps, review, release, etc. It is pretty complex set of code. The wrapper and having this live inside the existing master page is pretty important also. A web part is really just a .ASCX control in the .net world. You are right. We should be able to make as a web part. I think what we will do is develop stand alone and just put the control on a .ASPX page with Session / User ID static. There are about 5 other vars pulled from the session, but we can make static also. Then code all as a control so it can be deployed as Webpart.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on January 23, 2018 20:09

You can do a multi-step process by dynamically loading other user controls within your webpart to help keep the webpart complexity down and logic where it should be. For a good example, take a look at the MyAccount webpart (\CMSWebparts\Membership\Profile\MyAccount.aspx) In there, you can see they are loading user controls and providing links to other user controls with url params which only the webpart sees.

To also have the wrapper which sets your variables, you create that as it's own webpart which calls your specific logic to set those variables in the specific events you want. Then you place this webpart on the master page. When a user visits the site those variables are set based on whatever logic you have in place and are then accessible in your other user controls and webparts. Taken this approach many times vs. having ASPX pages complicate the process and upgrade path.

I'm not stating it's 100% the right way to go but I've proven it works in many applications and its simple to maintain and upgrade.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.