Microsoft Content Management Server - pROBLEMS AUTHORISING PAGE

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > June 2004 > pROBLEMS AUTHORISING PAGE





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 pROBLEMS AUTHORISING PAGE
JOHN HEELY

2004-06-20, 11:04 pm

I have just created my first page.
But after I have added content and saved the page I try
to authorise it and I get the following error message.

How can I resolve this
Cheers
John
Server Error in '/rotherham' 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.NullReferenceException: Object
reference not set to an instance of an object.

Source Error:


Line 244: public bool isgraphicsposting
(Posting cmsPost)
Line 245: {
Line 246: string
cmsThisPostPageType = cmsPost.CustomProperties
["PageType"].Value;
Line 247: if
(cmsThisPostPageType.ToLower().IndexOf("graphic") >= 0)
Line 248: {


Source File:
C:\Inetpub\wwwroot\rotherham\Global.asax.cs Line: 246

Stack Trace:


[NullReferenceException: Object reference not set to an
instance of an object.]
rotherham.Global.isgraphicsposting(Posting cmsPost) in
C:\Inetpub\wwwroot\rotherham\Global.asax.cs:246
rotherham.Global.CmsPosting_Approving(Object source,
ChangingEventArgs e) in
C:\Inetpub\wwwroot\rotherham\Global.asax.cs:194

[TargetInvocationException: Exception has been thrown by
the target of an invocation.]
Microsoft.ContentManagement.Publishing.Posting.Approve
() +130

Microsoft.ContentManagement.WebControls.ConsoleControls.Ap
proveAction.PerformActionBehavior() +44

Microsoft.ContentManagement.WebControls.ConsoleControls.Ba
sePostbackAction.RaisePostBackEvent(String eventArgument)
+36
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +138
System.Web.UI.Page.ProcessRequestMain() +1277



Emmanuel Desigaud

2004-06-20, 11:04 pm


Hey John

Your problem looks simple.
On line 246, you have to check if you custom property exists otherwise it will raise a null pointer exception !

>string cmsThisPostPageType = cmsPost.CustomProperties["PageType"].Value;


Code will look like :

CustomProperty myProperty = cmsPost.CustomProperties["PageType"];
String cmsThisPostPageType = "";
if (myProperty != null)
{
cmsThisPostPageType = myProperty.Value;
}

First we check if property exist and if so, we get the value.

Hope it helps

Emmanuel
--------------------------------------
You can contact me here : http://man.unice.net/contact.php
Please ask questions on newsgroup and not on email


"JOHN HEELY" wrote:

> I have just created my first page.
> But after I have added content and saved the page I try
> to authorise it and I get the following error message.
>
> How can I resolve this
> Cheers
> John
> Server Error in '/rotherham' 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.NullReferenceException: Object
> reference not set to an instance of an object.
>
> Source Error:
>
>
> Line 244: public bool isgraphicsposting
> (Posting cmsPost)
> Line 245: {
> Line 246: string
> cmsThisPostPageType = cmsPost.CustomProperties
> ["PageType"].Value;
> Line 247: if
> (cmsThisPostPageType.ToLower().IndexOf("graphic") >= 0)
> Line 248: {
>
>
> Source File:
> C:\Inetpub\wwwroot\rotherham\Global.asax.cs Line: 246
>
> Stack Trace:
>
>
> [NullReferenceException: Object reference not set to an
> instance of an object.]
> rotherham.Global.isgraphicsposting(Posting cmsPost) in
> C:\Inetpub\wwwroot\rotherham\Global.asax.cs:246
> rotherham.Global.CmsPosting_Approving(Object source,
> ChangingEventArgs e) in
> C:\Inetpub\wwwroot\rotherham\Global.asax.cs:194
>
> [TargetInvocationException: Exception has been thrown by
> the target of an invocation.]
> Microsoft.ContentManagement.Publishing.Posting.Approve
> () +130
>
> Microsoft.ContentManagement.WebControls.ConsoleControls.Ap
> proveAction.PerformActionBehavior() +44
>
> Microsoft.ContentManagement.WebControls.ConsoleControls.Ba
> sePostbackAction.RaisePostBackEvent(String eventArgument)
> +36
> System.Web.UI.Page.RaisePostBackEvent
> (IPostBackEventHandler sourceControl, String
> eventArgument) +18
> System.Web.UI.Page.RaisePostBackEvent
> (NameValueCollection postData) +138
> System.Web.UI.Page.ProcessRequestMain() +1277
>
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com