To be more specific...
namespace CIBWeb
{
public class BasePage : System.Web.UI.P age
{
public BasePage()
{
}
protected override void OnInit(EventArg s e)
{
if (
HttpContext.Cur rent.Request.Co okies["source_cod e"].Value.ToString () !=
string.Empty )
{
...
}
...
}
}
}
YIELDS THIS ERROR ...
Server Error in '/CIBWeb' Application.
----------------------------------------------------------------------------
----
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.NullRefe renceException: Object reference not set
to an instance of an object.
Source Error:
Line 64: // no other source code overrides it. ex: user clicks url in
email (email campaign) and then once on the site clicks on a ad banner
(which has
Line 65: // it's own source code), the first source code should still be
the one used
Line 66: if (
HttpContext.Cur rent.Request.Co okies["source_cod e"].Value.ToString () !=
string.Empty )
Line 67: {
Line 68: SourceCode =
HttpContext.Cur rent.Request.Co okies["source_cod e"].Value.ToString ();
Source File: c:\inetpub\wwwr oot\cibweb\src\ basepage.cs Line: 66
Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
CIBWeb.BasePage .OnInit(EventAr gs e) in
c:\inetpub\wwwr oot\cibweb\src\ basepage.cs:66
CIBWeb.HealthWe llness._Default .OnInit(EventAr gs e) in
c:\inetpub\wwwr oot\CIBWeb\Heal thWellness\Defa ult.aspx.cs:74
System.Web.UI.C ontrol.InitRecu rsive(Control namingContainer )
System.Web.UI.P age.ProcessRequ estMain()
ANY IDEAS?
"Brian K. Williams" <wi*******@mill enia.com> wrote in message
news:uz******** ******@TK2MSFTN GP12.phx.gbl...
Are you using Request.QuerySt ring.Get("name" ).Value?
-Brian K. Williams
"Terry Mulvany" <te****@mcelroy la.com> wrote in message
news:Oi******** ******@TK2MSFTN GP09.phx.gbl... I have a 'BasePage' (BasePage.cs) derived from System.Web.UI.P age that
all my pages inherit from. I need to set some properties (either in the
OnInit or constructor) based on a potential Request.Cookie or a name/value pair
in Request.QuerySt ring.
But I am getting a
'System.NullRef erenceException : Object reference not set to an instance
of an object.'
error when I try to view any aspx derived from this BasePage.
I am using HttpContext.Cur rent.Request.Co okies as well as for the
QueryString but still get this error.
Any ideas!?
Thank you.