Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 14:
Line 15: Property nodeProperty = curNode.GetProperty("redirectionURL");
Line 16: red = nodeProperty.Value;
Line 17:
Line 18: if(red=="" )
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
ASP.masterpagesredirectionpagemaster.Page_Load(Object sender, EventArgs e) in
System.Web.UI.Control.OnLoad(EventArgs e) +108
System.Web.UI.Control.LoadRecursive() +67
System.Web.UI.Control.LoadRecursive() +164
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4497
Make sure that curNode is not null. Best to always check it before calling the property.
And make sure that the docType of that node has redirectionURL property.
Umbraco 6 nodeProperty Error
the code is working in umbraco 4.7 but it is not working umb 6+ what is the problem
Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object. Source Error:
Line 14:
Line 15: Property nodeProperty = curNode.GetProperty("redirectionURL"); Line 16: red = nodeProperty.Value; Line 17:
Line 18: if(red=="" )
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] ASP.masterpagesredirectionpagemaster.Page_Load(Object sender, EventArgs e) in
System.Web.UI.Control.OnLoad(EventArgs e) +108 System.Web.UI.Control.LoadRecursive() +67 System.Web.UI.Control.LoadRecursive() +164 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4497
Hi Burak.
It sounds like 'nodeProperty might be null?
Could you do a null check on nodeProperty before you call nodeProperty.Value?
Hi Dennis thx for your answer but ı try it not working
Have you made sure curNode is not null?
Looking at https://our.umbraco.org/forum/developers/api-questions/46586-Get-current-node-as-IPublishedContent it looks like Node.GetCurrent doesn't work after Umbraco 4. Try replacing it with CurrentPage or with the UmbracoHelper.
Hi burak.
Did you figure this problem out? Could you share your solution?
All the best!
no I m not
Sorry to hear that. Did you make sure curNode is not null? Since it seems Node.GetCurrent() is obsolete.
Otherwise do you have Visual Studio? Could you try debugging to se which variable in your code is null. Without debugging it's more or less guessing..
I tried but could not it. can you share all code with me how can ı make curNode not null ??
Make sure that curNode is not null. Best to always check it before calling the property. And make sure that the docType of that node has redirectionURL property.
Hi burak.
To be honest it's been a wile since I worked with Umbraco 6 and WebForms, but here is a try:
Make sure that you dont miss
<%@ Import Namespace="Umbraco.Web" %>
, it's very important.Hi Dennis ; Finally happened.. Thank you so much.. Thank you
Thank you Burak!
I'm glad to hear that it worked out for you, happy to help!
Have a great day!
is working on a reply...