473,769 Members | 8,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Web.UI.P age derivative...

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.
Nov 18 '05 #1
4 5094
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.

Nov 18 '05 #2
What is the line of code that is throwing this exception? There is an object
reference in that line that is not initialized or is null for some reason.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"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.

Nov 18 '05 #3
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?
"Kevin Spencer" <ke***@takempis .com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
What is the line of code that is throwing this exception? There is an object reference in that line that is not initialized or is null for some reason.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"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.


Nov 18 '05 #4
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.


Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2849
by: David B. Bitton | last post by:
I'm experiencing odd behavior on the part of the XMLSerializer. I'm deserializing an XmlNode. The XmlNode is pass as part of a call to IConfigurationSectionHandler.Create. My XML looks like: <sectionName> <settings> ... ... ... </settings>
2
1717
by: Terry Mulvany | last post by:
namespace CIBWeb { public class BasePage : System.Web.UI.Page { public BasePage() { } protected override void OnInit(EventArgs e) {
4
3647
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed and reaches a specific length, it terminates printing that page, prints a page number, and then begins to print the next page using the same header and format as the previous page. The page uses no tables or paragraph elements, only CSS. IOW, I...
3
1891
by: xhunga | last post by:
Hello, This time I try to simulate the derivative of a product. Into a text file, I have an equation of this type. I have created these equations with the previous functions. Examples:
0
1500
by: xhunga | last post by:
Symbolic computation : the derivative of a quotient. Hello, This time I try to simulate the derivative of a quotient. The same function use the quotient rule if it is a quotient (f/g) and the reciprocal rule if it is not a quotient. (1/g) Into a text file, I have an equation of this type.
9
3042
by: Xah Lee | last post by:
REQUIREMENTS FOR A VISUALIZATION SOFTWARE SYSTEM FOR 2010 Xah Lee, 2007-03-16 In this essay, i give a list of requirements that i think is necessary for a software system for creating scientific visualization for the next decade (2007-2017). (for a HTML version with images, please see http://xahlee.org/3d/viz.html )
10
8832
by: DDCane | last post by:
i have made a code for finding a derivative and now im trying to use it to help me with a code for the newton raphson method: def derivative (f,x,h): import math return float(1/(2*h)) * (f(x+h) - f(x-h)) def solve (f,x0,h): delta= f(x(n))/fp(x(n) for x(n+1) in solve(): x(n)-delta
3
1524
by: jlynx23 | last post by:
gud am...i am currently working with a project of mine which is about derivative...and i am having some problem with the printing of the derivative... here is the block of code i used: /* print derivative of each term */ x=30; gotoxy(x, 15); if(exponent!=0){ if(coefficient*exponent>=1){ printf("%d",coefficient*exponent);
6
14982
by: knielsen73 | last post by:
Hi, I am looking to do a simple derivative. I would expect such a function to be available in numpy, but can't find it. I have written my own, but just curious if anybody knows of such function in numpy. Cheers, Kim
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.