What does this error mean?, I keep getting this error, it use to work fine and it just started throwing this error…. any help?
img1.ImageUrl = ConfigurationManager.AppSettings.Get("Url").Replace("###", randomString)
+ Server.UrlEncode(((System.Web.UI.MobileControls.Form)Page.FindControl("mobileForm")).Title);
An exception of type ‘System.NullReferenceException’ occurred in
MyProject.DLL but was not handled in user codeAdditional information: Object reference not set to an instance of an
object.
It means somewhere in your chain of calls, you tried to access a Property or call a method on an object that was
null.Given your statement:
I’m guessing either the call to
AppSettings.Get("Url")is returning null because the value isn’t found or the call toPage.FindControl("mobileForm")is returning null because the control isn’t found.You could easily break this out into multiple statements to solve the problem: