I'm currently trying to move our website from it's current (live) to another (backup) server and at the same time performing the long over due upgrade from 3.0.5 to 4.5.2
After a couple of minor hiccups I've managed to get the site working except for some of the usercontrols which should be accessing the members section. I keep getting
System.NullReferenceException: Object reference not set to an instance of an object.
The controls work fine on the 'live' server, but on the new server the controls don't seem to be able to access the umbraco.cms.businesslogic.member.Member object.
I'm hoping that there is a quick / easy fix to this as I'd rather not have to rebuild the whole thing again.
Could you perhaps show some of the code form the user control that shows the exception? It's very likely that changes have happened to the API between those two versions so maybe code should be rewritten/refactored to make it work with the new version of Umbraco?
using umbraco; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.member; using umbraco.cms.businesslogic.propertytype; using umbraco.interfaces;
..........
protected void Page_Load(object sender, EventArgs e) { Member member = Member.GetCurrentMember();
When I replied to Jasons post, i said that it couldn't access the current member when they are logged in. I was wrong.
When a user logs in, the login page returns the username to them that seems to be working.
However, when the user tries to access the 'edit account' section I get a different error:
Server Error in '/' Application.
Unable to cast object of type 'ASP.default_aspx' to type 'umbraco.BasePages.UmbracoEnsuredPage'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Unable to cast object of type 'ASP.default_aspx' to type 'umbraco.BasePages.UmbracoEnsuredPage'.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace: [InvalidCastException: Unable to cast object of type 'ASP.default_aspx' to type 'umbraco.BasePages.UmbracoEnsuredPage'.]
umbraco.controls.ContentControl.CreateChildControls() +331
System.Web.UI.Control.EnsureChildControls() +87
umbraco.controls.ContentControl.OnInit(EventArgs e) +92
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.AddedControl(Control control, Int32 index) +198
System.Web.UI.ControlCollection.Add(Control child) +80
....................
I guess there is something I'm missing (Thank you captain obvious!)
Again, thanks for any suggestions you can give me.
I have only edited the web.config and dashboard.config files. Everything else was either copied from the live server, or from the upgrade zip file.
I made sure that I ran the upgrade after I copied everything else across, so I wouldn't accidentaly overwrite a new dll with an old one.
I bet there is some form of setting that I have missed / forgotten / didn't know about.
But as it is only one page that is bringing up this error, I can't imagine what it can be. Going to try and rebuild the usercontrol, but if another idea presents itself I would feel alot better...
usercontrols not working after upgrade
Hi all,
I'm currently trying to move our website from it's current (live) to another (backup) server and at the same time performing the long over due upgrade from 3.0.5 to 4.5.2
After a couple of minor hiccups I've managed to get the site working except for some of the usercontrols which should be accessing the members section. I keep getting
The controls work fine on the 'live' server, but on the new server the controls don't seem to be able to access the umbraco.cms.businesslogic.member.Member object.
I'm hoping that there is a quick / easy fix to this as I'd rather not have to rebuild the whole thing again.
Any suggestions?
Thanks
Hi doited
Could you perhaps show some of the code form the user control that shows the exception? It's very likely that changes have happened to the API between those two versions so maybe code should be rewritten/refactored to make it work with the new version of Umbraco?
/Jan
Hi Jan
The problem happens during the load event below:
I've narrowed it down to the 'Member member = Member.GetCurrentMember();' line.
Thanks again
Are you sure they are logged in? If there is no CurrentMember, it could return NULL.
hi jason,
i realise that could produce the error, but it cannot access the CurrentMember even if they are logged in.
Could it be something with the membership provider?
Check your web.config for that. My section looks like this:
Sorry, I've made a bit of a mistake.
When I replied to Jasons post, i said that it couldn't access the current member when they are logged in. I was wrong.
When a user logs in, the login page returns the username to them that seems to be working.
However, when the user tries to access the 'edit account' section I get a different error:
I guess there is something I'm missing (Thank you captain obvious!)
Again, thanks for any suggestions you can give me.
have you changed anything in the default.aspx file that comes with umbraco?
No.
I have only edited the web.config and dashboard.config files. Everything else was either copied from the live server, or from the upgrade zip file.
I made sure that I ran the upgrade after I copied everything else across, so I wouldn't accidentaly overwrite a new dll with an old one.
I bet there is some form of setting that I have missed / forgotten / didn't know about.
But as it is only one page that is bringing up this error, I can't imagine what it can be. Going to try and rebuild the usercontrol, but if another idea presents itself I would feel alot better...
is working on a reply...