Incomplete absolute URL in page settings causes pages to disappear from menu

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.
2/5/2009 4:59:12 AM
Gravatar
Total Posts 43

Incomplete absolute URL in page settings causes pages to disappear from menu

Hi,

Screenshot of bug is here.

Entering an incomplete URL into the "URL" field in a page's settings causes the site to return an error and the menu to no longer load, or load incorrectly.

This can have disastrous consequences if the pages that disappear require to be up available (for example for regulatory reasons) due to a simple mistake in entering a URL.

Validation could easily check that correct URLs are being entered and stop typos from taking down entire sections of the site.

All the best,

Kenny

2/5/2009 5:44:42 AM
Gravatar
Total Posts 18439

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

Hi Kenny,

Perhaps I can put in better error handling for that case but validation is more complicated than it appears. There are several patterns that are acceptable including ~/mywebpage.com and http://www.mysite.com/mywebpage.com, but not tp://www.mysite/mywebpage.com

I will look into trying to cause this error and trying to prevent it from causing general failure of the menu. I will try to make it just skip that node if it is invalid so only the bad url is left out of the menu. If the bad page is left out of the menu, you can still get to it to correct it from Administration Menu > Add/Edit Pages, so you can correct it.

Best,

Joe

2/5/2009 5:50:30 AM
Gravatar
Total Posts 43

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

Hi Joe,

Skipping the invalid entry would certainly add to the stability of mojoportal overall!

Stacktrace if you like:

2009-02-05 10:36:36,012 [5124] ERROR mojoPortal.Web.Global [(null)] - xx.xx.xx.xx -en-US - /Default.aspx
System.Web.HttpException: 'ttp://website/new-page.aspx' is not a valid virtual path.
at System.Web.Util.UrlPath.CheckValidVirtualPath(String path)
at System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative)
at System.Web.StaticSiteMapProvider.AddNode(SiteMapNode node, SiteMapNode parentNode)
at mojoPortal.Web.mojoSiteMapProvider.CreateChildNodes(mojoSiteMapNode node, PageSettings page, Int32 depth)
at mojoPortal.Web.mojoSiteMapProvider.CreateSiteMapNode(PageSettings page, Int32 depth)
at mojoPortal.Web.mojoSiteMapProvider.BuildSiteMap()
at mojoPortal.Web.mojoSiteMapProvider.GetRootNodeCore()
at System.Web.SiteMapProvider.get_RootNode()
at System.Web.UI.WebControls.SiteMapDataSource.GetNodes()
at System.Web.UI.WebControls.SiteMapDataSource.GetTreeView(String viewPath)
at System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(String viewPath)
at System.Web.UI.HierarchicalDataSourceControl.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView(String viewPath)
at System.Web.UI.WebControls.HierarchicalDataBoundControl.GetData(String viewPath)
at System.Web.UI.WebControls.Menu.DataBindItem(MenuItem item)
at System.Web.UI.WebControls.Menu.PerformDataBinding()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.Menu.DataBind()
at mojoPortal.Web.UI.SiteMenu.RenderMenu()
at mojoPortal.Web.UI.SiteMenu.PopulateControls()
at mojoPortal.Web.UI.SiteMenu.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

All the best!

Kenny

2/5/2009 5:51:24 AM
Gravatar
Total Posts 18439

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

I guess I could add validation that just checks the beginning of the string to make sure its either ~/,  http://, or https://

I was thinking regex before and I suck at that :-)

Best,

Joe

2/5/2009 5:56:56 AM
Gravatar
Total Posts 43

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

That sounds like a plan!

My favourite regex site: http://www.regular-expressions.info/ - good luck :)

Best,

K

2/5/2009 6:08:10 AM
Gravatar
Total Posts 18439

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

I'll tell you what, if you can come up with a regex pattern that can validate that the string starts with

~/

http://

or

https://

I would consider it a great contribution to the project because even with the help of sites like that I always struggle with regular expressions, they make my head hurt. I can easily do the check in C# but it really would be nicer to just use a regular expression validator for this.

Best,

Joe

2/5/2009 7:08:55 AM
Gravatar
Total Posts 18439

Re: Incomplete absolute URL in page settings causes pages to disappear from menu

I got the error handling improved on my local copy and will look into a regex validation this afternoon. It really shouldn't be too hard, for me its really just a mental block I have because I don't really enjoy working on regular expressions.

Cheers,

Joe

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