Hi,
Most of the time
Object Reference exception is cause by invalid name or accessing field for null object.
So, when you do coding. make sure you have all the required checking conditions. don't bother about number of lines. sometime people think, reducing line of code is good. Correct. but also minimize possibility of errors.
example :
if you are accessing cookies value Request.Cookies["Mycookie"].Value please use condition before this call.
if(Request.Cookies["Mycookie"] != null)
{
ASPxLabel1.Text = Server.HtmlEncode(Request.Cookies["Mycookie"].Value);
}
OR
ASPxLabel1.Text =
Request.Cookies["Mycookie"] ? "" : Server.HtmlEncode(Request.Cookies["Mycookie"].Value);
Hope this will help you in your code,
thanks
-Amit