Microsoft Content Management Server - NullReferenceException in Microsoft.ContentManagement.WebControls

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > September 2005 > NullReferenceException in Microsoft.ContentManagement.WebControls





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author NullReferenceException in Microsoft.ContentManagement.WebControls
Mike Sharp

2005-09-20, 8:48 pm

We're having a very strange problem. If a user visits our site with no
User-Agent string, an unhandled HTTP exception occurs in
Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler().
Here are the error details:

========================================
===
ExceptionType: System.NullReferenceException
Error Handled in Global.asax (outer exception is UnhandledHTTPException)
Base Error Details:
Name: NullReferenceException
Caused by page: /Templates/Navigation/Section.aspx
Line:
File:
Message: Object reference not set to an instance of an object.
Target Site: Boolean get_IsWebCrawler()
Source: Microsoft.ContentManagement.WebControls
Stack Trace: at
Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler()
at Microsoft.ContentManagement.WebControls.BaseWebAuthor.get_Available()
at
Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
on.get_Available()
at
Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
on.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
========================================
===

The IIS Logs for this request look like (removed the date and IP address to
shorten it up, [my comments in brackets]

[of course, these lines don't appear on our live site, which is read-only]
GET /Education/ - 80 - 172.19.15.116 - 401 2 2148074254
GET /Education/ - 80 - 172.19.15.116 - 401 1 0

[the next line is where the error occurs, and our code redirects to a
"friendly" error page]
GET /Education/ - 80 dev\michaels 172.19.15.116 - 302 0 0
GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80 -
172.19.15.116 - 401 2 2148074254
GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80 -
172.19.15.116 - 401 1 0
GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80
dev\michaels 172.19.15.116 - 200 0 0

[the browser makes a separate request for the favicon.ico, so it's going to
throw another exception]
GET /custom404.htm URL=%2ffavicon.ico 80 dev\michaels 172.19.15.116 - 302 0
0
GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80 -
172.19.15.116 - 401 2 2148074254
GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80 -
172.19.15.116 - 401 1 0
GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80
dev\michaels 172.19.15.116 - 200 0 0


When there is no user-agent string, HttpContext.Current.Request.UserAgent
returns a null, and it appears that get_IsWebCrawler() is assuming a
non-null user agent, with code something like:

bool bIsWebCrawler = false;
userAgent = HttpContext.Current.Request.UserAgent;
if (userAgent.IndexOf("SomeSearchString") > -1)
{
// the request is from a search bot
bIsWebCrawler = true;
}
return bIsWebCrawler;

We've made a bunch of code changes to our MCMS site, and have deployed the
new version on Windows 2003. The really odd part about this is our old
code, under Windows 2000 and IIS 5, doesn't seem to have this problem.

I'd like to either:

1. Handle the exception somewhere, so that I can display the correct page,
instead of our error page. This means I can't wait until Global.asax gets
the error.

2. Fix the offending code so that it checks for null before attempting to
do something with the UserAgent string. However this appears to be in the
MCMS code, so I may be out of luck here, unless I can disable
WebAuthorContext.get_IsWebCrawler()...We have a PSS contract, so if there is
a hotfix, I can easily get it if I know about it.

Any suggestions are greatly appreciated!

Regards,
Mike





Stefan [MSFT]

2005-09-20, 8:48 pm

Hi Mike,

that will only happen if the user has more rights than subscriber.
For these users the console is rendered.
And as you might have heard: authoring can only be done using Internet
Explore not with any other browser.
And loging in using an account with more than subscriber rights is actually
treated as authoring in this situation.
The reason is that IE sends all the required headers.

This behaviour is by design.

Workaround: send all the headers IE sends.

Cheers,
Stefan

--
This posting is provided "AS IS" with no warranties, and confers no rights

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------


"Mike Sharp" <rdcpro@hotmail.com> wrote in message
news:ejoBaAhvFHA.2212@TK2MSFTNGP15.phx.gbl...
> We're having a very strange problem. If a user visits our site with no
> User-Agent string, an unhandled HTTP exception occurs in
> Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler().
> Here are the error details:
>
> ========================================
===
> ExceptionType: System.NullReferenceException
> Error Handled in Global.asax (outer exception is UnhandledHTTPException)
> Base Error Details:
> Name: NullReferenceException
> Caused by page: /Templates/Navigation/Section.aspx
> Line:
> File:
> Message: Object reference not set to an instance of an object.
> Target Site: Boolean get_IsWebCrawler()
> Source: Microsoft.ContentManagement.WebControls
> Stack Trace: at
> Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler()
> at Microsoft.ContentManagement.WebControls.BaseWebAuthor.get_Available()
> at
> Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
> on.get_Available()
> at
> Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
> on.OnLoad(EventArgs e)
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Control.LoadRecursive()
> at System.Web.UI.Page.ProcessRequestMain()
> ========================================
===
>
> The IIS Logs for this request look like (removed the date and IP address
> to
> shorten it up, [my comments in brackets]
>
> [of course, these lines don't appear on our live site, which is read-only]
> GET /Education/ - 80 - 172.19.15.116 - 401 2 2148074254
> GET /Education/ - 80 - 172.19.15.116 - 401 1 0
>
> [the next line is where the error occurs, and our code redirects to a
> "friendly" error page]
> GET /Education/ - 80 dev\michaels 172.19.15.116 - 302 0 0
> GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80 -
> 172.19.15.116 - 401 2 2148074254
> GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80 -
> 172.19.15.116 - 401 1 0
> GET /ErrorPage.aspx aspxerrorpath=/Templates/Navigation/Section.aspx 80
> dev\michaels 172.19.15.116 - 200 0 0
>
> [the browser makes a separate request for the favicon.ico, so it's going
> to
> throw another exception]
> GET /custom404.htm URL=%2ffavicon.ico 80 dev\michaels 172.19.15.116 - 302
> 0
> 0
> GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80 -
> 172.19.15.116 - 401 2 2148074254
> GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80 -
> 172.19.15.116 - 401 1 0
> GET /ErrorPage.aspx aspxerrorpath=/Templates/System/Custom404.aspx 80
> dev\michaels 172.19.15.116 - 200 0 0
>
>
> When there is no user-agent string, HttpContext.Current.Request.UserAgent
> returns a null, and it appears that get_IsWebCrawler() is assuming a
> non-null user agent, with code something like:
>
> bool bIsWebCrawler = false;
> userAgent = HttpContext.Current.Request.UserAgent;
> if (userAgent.IndexOf("SomeSearchString") > -1)
> {
> // the request is from a search bot
> bIsWebCrawler = true;
> }
> return bIsWebCrawler;
>
> We've made a bunch of code changes to our MCMS site, and have deployed the
> new version on Windows 2003. The really odd part about this is our old
> code, under Windows 2000 and IIS 5, doesn't seem to have this problem.
>
> I'd like to either:
>
> 1. Handle the exception somewhere, so that I can display the correct
> page,
> instead of our error page. This means I can't wait until Global.asax gets
> the error.
>
> 2. Fix the offending code so that it checks for null before attempting to
> do something with the UserAgent string. However this appears to be in the
> MCMS code, so I may be out of luck here, unless I can disable
> WebAuthorContext.get_IsWebCrawler()...We have a PSS contract, so if there
> is
> a hotfix, I can easily get it if I know about it.
>
> Any suggestions are greatly appreciated!
>
> Regards,
> Mike
>
>
>
>
>



Mike Sharp

2005-09-20, 8:48 pm

Thanks for you reply, Stefan.

I can understand how this would happen on our editing server (inside the
firewall, NT Auth). But it also happens on our live site, which is
configured as Read Only. CMSGuest is a member of the Subscribers rights
group, and there are no other rights groups other than Administrator, and
CMSGuest isn't in that group.

I'm beginning to think I have some problem with the configuration of our
live site. I can repro this issue on our old editing server (Window 2000)
but on our old live site, it does not occur. On the new editing server, it
occurs, and it also occurs on our new live site (both Windows 2003).

As far as I know, the authoring controls shouldn't even be instantiating on
our live servers (they are configured read-only, Guest allowed--CMSGuest).
Could there be something wrong with our configuration here?

Regards,
Mike


"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:uUAbMLhvFHA.596@TK2MSFTNGP12.phx.gbl...
> Hi Mike,
>
> that will only happen if the user has more rights than subscriber.
> For these users the console is rendered.
> And as you might have heard: authoring can only be done using Internet
> Explore not with any other browser.
> And loging in using an account with more than subscriber rights is

actually
> treated as authoring in this situation.
> The reason is that IE sends all the required headers.
>
> This behaviour is by design.
>
> Workaround: send all the headers IE sends.
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
> New to MCMS?
> Check out this book: Building Websites Using MCMS:

http://tinyurl.com/6zj44
> ----------------------
>
>
> "Mike Sharp" <rdcpro@hotmail.com> wrote in message
> news:ejoBaAhvFHA.2212@TK2MSFTNGP15.phx.gbl...
Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler().[vbcol=seagreen]
Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler()[vbcol=seagreen]
Microsoft.ContentManagement.WebControls.BaseWebAuthor.get_Available()[vbcol=seagreen]
Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi[vbcol=seagreen]
Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi[vbcol=seagreen]
read-only][vbcol=seagreen]
80 -[vbcol=seagreen]
80 -[vbcol=seagreen]
302[vbcol=seagreen]
HttpContext.Current.Request.UserAgent[vbcol=seagreen]
the[vbcol=seagreen]
gets[vbcol=seagreen]
to[vbcol=seagreen]
the[vbcol=seagreen]
there[vbcol=seagreen]
>
>



Mike Sharp

2005-09-20, 8:48 pm

Ok...I fixed it. You were right about the issue on our editing server, but
there was a separate problem on our read-only DMZ Test server that masked my
issue...once I fixed that problem, everything works as it should.

Thanks!
Mike

"Mike Sharp" <rdcpro@hotmail.com> wrote in message
news:%2351xpaivFHA.2292@TK2MSFTNGP12.phx.gbl...
> Thanks for you reply, Stefan.
>
> I can understand how this would happen on our editing server (inside the
> firewall, NT Auth). But it also happens on our live site, which is
> configured as Read Only. CMSGuest is a member of the Subscribers rights
> group, and there are no other rights groups other than Administrator, and
> CMSGuest isn't in that group.
>
> I'm beginning to think I have some problem with the configuration of our
> live site. I can repro this issue on our old editing server (Window 2000)
> but on our old live site, it does not occur. On the new editing server,

it
> occurs, and it also occurs on our new live site (both Windows 2003).
>
> As far as I know, the authoring controls shouldn't even be instantiating

on
> our live servers (they are configured read-only, Guest allowed--CMSGuest).
> Could there be something wrong with our configuration here?
>
> Regards,
> Mike
>
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:uUAbMLhvFHA.596@TK2MSFTNGP12.phx.gbl...
> actually
rights[vbcol=seagreen]
> http://tinyurl.com/6zj44
no[vbcol=seagreen]
>

Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler().
UnhandledHTTPException)[vbcol=seagreen]
>

Microsoft.ContentManagement.WebControls.WebAuthorContext.get_IsWebCrawler()
> Microsoft.ContentManagement.WebControls.BaseWebAuthor.get_Available()
>

Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
>

Microsoft.ContentManagement.WebControls.ConsoleControls.AuthoringSaveNewActi
address[vbcol=seagreen]
> read-only]
> 80 -
> 80 -
80[vbcol=seagreen]
going[vbcol=seagreen]
> 302
80 -[vbcol=seagreen]
80 -[vbcol=seagreen]
> HttpContext.Current.Request.UserAgent
> the
old[vbcol=seagreen]
> gets
attempting[vbcol=seagreen]
> to
> the
> there
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com