Bug in Admin - PageSettings.aspx - pageId parameter

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
12/24/2010 6:15:12 PM
Gravatar
Total Posts 8

Bug in Admin - PageSettings.aspx - pageId parameter

if you just open the page PageSettings.aspx in the admin folder you will be by default in the "Add New Page" mode, but if you add the parameter pageId with any Non-Exist page number to URL in the browser :

Admin/PageSettings.aspx?pageId=123456

Here you will be in "Edit Page" with invalid PageId .

We could solve this be checking the result of the Page_Load in this code :

if (pageId > -1)
{
pageSettings = new PageSettings(siteSettings.SiteId, pageId);
}

if we don't get valid page entity even if the pageId is greater that -1 , simple Re-Assign pageId to -1 and replace "else" with :

if (pageId < 0)

the final code will be :

if (pageId > -1)
{
pageSettings = new PageSettings(siteSettings.SiteId, pageId);
// Check if we get valid page entity , Not new page
if (!IsValidPage(pageSettings))
pageId = -1;
}
// else statement replaced with if statement
if (pageId < 0)
{
pageSettings = new PageSettings();
.....
}

12/28/2010 12:06:37 PM
Gravatar
Total Posts 18439

Re: Bug in Admin - PageSettings.aspx - pageId parameter

Hi khaled,

if we don't get valid page entity even if the pageId is greater that -1 , simple Re-Assign pageId to -1

This is already what happens in this code:

if(pageId > -1)
{
     pageSettings = new PageSettings(siteSettings.SiteId, pageId);
}
else

if a non existent page id (or one that may exist in a different site) is passed in, then the pageSettings object is created by this constructor with an id of -1 and it ignores the passed in id, so it is in new page creation mode already and the user must have permissions to create new pages or he will not be allowed. Since there are some places further down in the code where we check pageId again, I will change it like this to force the parameter back to -1:

if(pageId > -1)
{
      pageSettings = new PageSettings(siteSettings.SiteId, pageId);
      if (pageSettings.PageId == -1) { pageId = -1; }
}

if(pageId == -1)
{
     pageSettings = new PageSettings();

....
 

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.