Urgent Help for release...

G

Guest

Can someone please tell me why I keep getting the following error for some of
my web application users but not others??? Even though the application runs
from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument
 
K

Karl Seguin

Tim:
There's so many things it could be...


What happens if HTTP_REFERER is null or neither of the values indicated?
then ds.Tables(0) will throw a null reference
what happends if rowId is null? rowId.ToString() will throw a null reference
what happens if ds.Tables(0) doesn't exist? then tables.Rows() will throw a
null reference
what happens if there's no column called "content" ? then
row("content").ToString will throw a null reference (actually, that'll
likely throw a different error I think)

My guess is the first one..but it's impossible to tell for us (and should be
relatively easy for you).

By the way, your ds.Dispose() will never get called, it's AFTER the return..

Karl
 
G

Guest

It works fine on my development network but for some reason it doesn't work
when multiple users start to use it...

It is almost like only certain clients get connections to the SQL server???

Any ideas???

Thanks....

Milosz Skalecki said:
Elo,

Ensure rowId is properly set and GetDataSet does not return null reference.

--
Milosz Skalecki
MCP, MCAD


Tim::.. said:
Can someone please tell me why I keep getting the following error for some of
my web application users but not others??? Even though the application runs
from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument
 
G

Guest

Can you paste code of the GetDataSet method?
--
Milosz Skalecki
MCP, MCAD


Tim::.. said:
It works fine on my development network but for some reason it doesn't work
when multiple users start to use it...

It is almost like only certain clients get connections to the SQL server???

Any ideas???

Thanks....

Milosz Skalecki said:
Elo,

Ensure rowId is properly set and GetDataSet does not return null reference.

--
Milosz Skalecki
MCP, MCAD


Tim::.. said:
Can someone please tell me why I keep getting the following error for some of
my web application users but not others??? Even though the application runs
from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument
 
G

Guest

Thanks for the Tips Carl...

What I don't get is why some users can access the page while others can't???

Everything returns ok when I run it on the development lan... ???? Wierd

It's not the Request.ServerVariables("HTTP_REFERER") ,
QueryString is provided... I can see it in the url!
There is a column called 'content'

Any other ideas???

Do you think it is an IIS 6 problem???
Strange...



More Code...
--------------
'Get Text for Editor
If Not Page.IsPostBack Then
rowID = CType(Request.QueryString("ID"), Integer)
FreeTextBox1.Text = GetDocument()
End If

'Loads user controls
Dim c1 As Control = LoadControl("../userControls/footer.ascx")
phFooter.Controls.Add(c1)
Dim c2 As Control = LoadControl("../userControls/headerMenu.ascx")
phHeaderMenu.Controls.Add(c2)
Dim c3 As Control = LoadControl("../userControls/Header.ascx")
phHeader.Controls.Add(c3)
Dim c4 As Control = LoadControl("../userControls/QuickLinks.ascx")
phQuickLinks.Controls.Add(c4)
End Sub 'Page_Load

Public Sub Button_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
rowID = CType(Request.QueryString("ID"), Integer)
UpdateDocument(FreeTextBox1.Text)
End Sub 'Button_Click

'Why not just pass a variable to the page, in the Querystring to
'differentiate the page you came from? Instead of using Cache or Boolean

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://10.160.224.12/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://10.160.224.12/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
ds.Dispose()
Return doc

End Function 'GetDocument

Karl Seguin said:
Tim:
There's so many things it could be...


What happens if HTTP_REFERER is null or neither of the values indicated?
then ds.Tables(0) will throw a null reference
what happends if rowId is null? rowId.ToString() will throw a null reference
what happens if ds.Tables(0) doesn't exist? then tables.Rows() will throw a
null reference
what happens if there's no column called "content" ? then
row("content").ToString will throw a null reference (actually, that'll
likely throw a different error I think)

My guess is the first one..but it's impossible to tell for us (and should be
relatively easy for you).

By the way, your ds.Dispose() will never get called, it's AFTER the return..

Karl


--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)


Tim::.. said:
Can someone please tell me why I keep getting the following error for some
of
my web application users but not others??? Even though the application
runs
from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument
 
K

Karl Seguin

I don't think it's an IIS 6 problem, i think it's your code. I think it's
HTTP_REFERER.

Browsers send information in headers...HTTP_REFERER isn't a required header
in the HTTP protocols. Many firewalls, namely symantec, always removes
HTTP_REFERER. It's possible to make Firefox and Opera not display the
REFERER as well.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
Tim::.. said:
Thanks for the Tips Carl...

What I don't get is why some users can access the page while others
can't???

Everything returns ok when I run it on the development lan... ???? Wierd

It's not the Request.ServerVariables("HTTP_REFERER") ,
QueryString is provided... I can see it in the url!
There is a column called 'content'

Any other ideas???

Do you think it is an IIS 6 problem???
Strange...



More Code...
--------------
'Get Text for Editor
If Not Page.IsPostBack Then
rowID = CType(Request.QueryString("ID"), Integer)
FreeTextBox1.Text = GetDocument()
End If

'Loads user controls
Dim c1 As Control = LoadControl("../userControls/footer.ascx")
phFooter.Controls.Add(c1)
Dim c2 As Control = LoadControl("../userControls/headerMenu.ascx")
phHeaderMenu.Controls.Add(c2)
Dim c3 As Control = LoadControl("../userControls/Header.ascx")
phHeader.Controls.Add(c3)
Dim c4 As Control = LoadControl("../userControls/QuickLinks.ascx")
phQuickLinks.Controls.Add(c4)
End Sub 'Page_Load

Public Sub Button_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
rowID = CType(Request.QueryString("ID"), Integer)
UpdateDocument(FreeTextBox1.Text)
End Sub 'Button_Click

'Why not just pass a variable to the page, in the Querystring to
'differentiate the page you came from? Instead of using Cache or
Boolean

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://10.160.224.12/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://10.160.224.12/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
ds.Dispose()
Return doc

End Function 'GetDocument

Karl Seguin said:
Tim:
There's so many things it could be...


What happens if HTTP_REFERER is null or neither of the values indicated?
then ds.Tables(0) will throw a null reference
what happends if rowId is null? rowId.ToString() will throw a null
reference
what happens if ds.Tables(0) doesn't exist? then tables.Rows() will throw
a
null reference
what happens if there's no column called "content" ? then
row("content").ToString will throw a null reference (actually, that'll
likely throw a different error I think)

My guess is the first one..but it's impossible to tell for us (and should
be
relatively easy for you).

By the way, your ds.Dispose() will never get called, it's AFTER the
return..

Karl


--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)


Tim::.. said:
Can someone please tell me why I keep getting the following error for
some
of
my web application users but not others??? Even though the application
runs
from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference not
set
to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the
current
web
request. Information regarding the origin and location of the exception
can
be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument
 
H

Hans Kesting

Tim::.. said:
Can someone please tell me why I keep getting the following error for
some of my web application users but not others??? Even though the
application runs from a central webserver???


Thanks for any help...

Error:
-----

Exception Details: System.NullReferenceException: Object reference
not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
cpncms_v1.editor.GetDocument() +277
cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Code:
---------

Private Function GetDocument() As String
Dim ds As DataSet

If Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/viewpage.aspx" Then
ds = GetDataSet(("SELECT content FROM tblPageContent WHERE
pageID=" + rowID.ToString()))
Cache("iNews") = "False"
ElseIf Request.ServerVariables("HTTP_REFERER") =
"http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
ds = GetDataSet(("SELECT content FROM tblNewsArchive WHERE
newsID=" + rowID.ToString()))
Cache.Remove("iNews")
End If
Dim table As DataTable = ds.Tables(0)
Dim row As DataRow = table.Rows(0)
Dim doc As String = row("content").ToString()
Return doc
ds.Dispose()
End Function 'GetDocument

if HTTP_REFERER is not one of your two adresses (localhost???)
then the dataset (ds) will not have a value, so the code will break
in the "dim table" line.

Hans Kesting
 
S

Steven Cheng[MSFT]

Hi Tim,

AS you mentioned that this works with someone but not with some others and
other members has pointed that it is possibly the Dataset is not retireved
correclty, I'm suspecting that whether you've use impersonating in your web
application so that your sql connecting operation will fail when running
under certain client user's security context? Anyway, you can have a check
in your web application's secuirty setting also.

Thanks,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Urgent Help for release...
| thread-index: AcWvtC4pgUrYo+ICTMOvfKxkjYbZdg==
| X-WBNR-Posting-Host: 62.254.216.185
| From: =?Utf-8?B?TWlsb3N6IFNrYWxlY2tp?=
<[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
| Subject: RE: Urgent Help for release...
| Date: Fri, 2 Sep 2005 04:48:05 -0700
| Lines: 83
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:121976
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Can you paste code of the GetDataSet method?
| --
| Milosz Skalecki
| MCP, MCAD
|
|
| "Tim::.." wrote:
|
| > It works fine on my development network but for some reason it doesn't
work
| > when multiple users start to use it...
| >
| > It is almost like only certain clients get connections to the SQL
server???
| >
| > Any ideas???
| >
| > Thanks....
| >
| > "Milosz Skalecki" wrote:
| >
| > > Elo,
| > >
| > > Ensure rowId is properly set and GetDataSet does not return null
reference.
| > >
| > > --
| > > Milosz Skalecki
| > > MCP, MCAD
| > >
| > >
| > > "Tim::.." wrote:
| > >
| > > > Can someone please tell me why I keep getting the following error
for some of
| > > > my web application users but not others??? Even though the
application runs
| > > > from a central webserver???
| > > >
| > > >
| > > > Thanks for any help...
| > > >
| > > > Error:
| > > > -----
| > > >
| > > > Exception Details: System.NullReferenceException: Object reference
not set
| > > > to an instance of an object.
| > > >
| > > > Source Error:
| > > >
| > > > An unhandled exception was generated during the execution of the
current web
| > > > request. Information regarding the origin and location of the
exception can
| > > > be identified using the exception stack trace below.
| > > >
| > > > Stack Trace:
| > > >
| > > > [NullReferenceException: Object reference not set to an instance of
an
| > > > object.]
| > > > cpncms_v1.editor.GetDocument() +277
| > > > cpncms_v1.editor.Page_Load(Object sender, EventArgs e) +122
| > > > System.Web.UI.Control.OnLoad(EventArgs e) +67
| > > > System.Web.UI.Control.LoadRecursive() +35
| > > > System.Web.UI.Page.ProcessRequestMain() +731
| > > >
| > > > Code:
| > > > ---------
| > > >
| > > > Private Function GetDocument() As String
| > > > Dim ds As DataSet
| > > >
| > > > If Request.ServerVariables("HTTP_REFERER") =
| > > > "http://localhost/cpncms_v1/cms/viewpage.aspx" Then
| > > > ds = GetDataSet(("SELECT content FROM tblPageContent
WHERE
| > > > pageID=" + rowID.ToString()))
| > > > Cache("iNews") = "False"
| > > > ElseIf Request.ServerVariables("HTTP_REFERER") =
| > > > "http://localhost/cpncms_v1/cms/news/pgeEditor.aspx" Then
| > > > ds = GetDataSet(("SELECT content FROM tblNewsArchive
WHERE
| > > > newsID=" + rowID.ToString()))
| > > > Cache.Remove("iNews")
| > > > End If
| > > > Dim table As DataTable = ds.Tables(0)
| > > > Dim row As DataRow = table.Rows(0)
| > > > Dim doc As String = row("content").ToString()
| > > > Return doc
| > > > ds.Dispose()
| > > > End Function 'GetDocument
| > > >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top