Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio
This is the forum to discuss the Wrox book ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solution by Vincent Varallo; ISBN: 9780470396865
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2009, 04:54 AM
Authorized User
 
Join Date: Jun 2009
Posts: 11
Thanks: 1
Thanked 2 Times in 2 Posts
Default null reference object error

This line is giving me this error and I can't figure out why:

Code:
public virtual void CheckCapabilities()
{
if (IgnoreCapabilityCheck == false)
{
foreach (string capabilityName in CapabilityNames())
{
//Check if the user has the capability to view this screen
ENTCapabilityBO capability =Globals.GetCapabilities(this.Cache).GetByName(capabilityName);
if (capability == null)
{
throw new Exception(“Security is not enabled for this page. “ +
this.ToString());
}
else
{
switch 
(CurrentUser.GetCapabilityAccess(capability.ID,
Globals.GetRoles(this.Cache))) *** line with the error ***
{
case ENTRoleCapabilityEO.CapabiiltyAccessFlagEnum.None:
NoAccessToPage(capabilityName);
break;
case ENTRoleCapabilityEO.CapabiiltyAccessFlagEnum.ReadOnly:
MakeFormReadOnly(capabilityName, this.Controls);
break;
case ENTRoleCapabilityEO.CapabiiltyAccessFlagEnum.Edit:
//Do not make the form read only.
break;
default:
throw new Exception(“Unknown access for this screen. “ +
capability.CapabilityName);
}
}
capability = null;
}
}
}
can someone please help me? I'd rather not spend forever on it, thanks!
  #2 (permalink)  
Old June 9th, 2009, 11:15 AM
Authorized User
 
Join Date: Jun 2009
Posts: 11
Thanks: 1
Thanked 2 Times in 2 Posts
Default

ok, so it's clearly not something i mistyped because I'm using all of the files from the chapter 6 download (PaidTimeOffBLL.Framework) as well as the base load from the database script, AND the BasePage.cs from the same download; the page in which this error occurs.

this is running on my local laptop machine so my current user is <domainname>\<myname>

would this have any bearing on why it won't work?

if so, where do I change/add this information to the database to get it to function?

I'm at a standstill here and can't move on to the next chapter because I'm not even able to pull up any pages done so far due to this error.

HELP!!!!!!

Source Error:

Line 118: else
Line 119: {
Line 120: switch (CurrentUser.GetCapabilityAccess(capability.ID, Globals.GetRoles(this.Cache)))
Line 121: {
Line 122: case ENTRoleCapabilityEO.CapabilityAccessFlagEnum.None:
Source File: c:\VSWebsites\PaidTimeOffSolution\PaidTimeOffUI\Ap p_Code\BasePage.cs Line: 120

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
BasePage.CheckCapabilities() in c:\VSWebsites\PaidTimeOffSolution\PaidTimeOffUI\Ap p_Code\BasePage.cs:120
BasePage.OnInit(EventArgs e) in c:\VSWebsites\PaidTimeOffSolution\PaidTimeOffUI\Ap p_Code\BasePage.cs:98
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +378

Last edited by GenXisT; June 9th, 2009 at 11:19 AM..
  #3 (permalink)  
Old June 9th, 2009, 01:47 PM
Authorized User
 
Join Date: Jun 2009
Posts: 11
Thanks: 1
Thanked 2 Times in 2 Posts
Default

figured it out myself.

thanks.
  #4 (permalink)  
Old January 15th, 2010, 11:42 AM
Authorized User
 
Join Date: Nov 2009
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hi,

I'm having a similar issue with CapabilityNames(), how did you fix?

Gilbo
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
display Null or Not an object error kishy449 Classic ASP Professional 1 September 4th, 2007 01:21 PM
Error: (variable) is null or not an object alisonchase JSP Basics 1 February 14th, 2005 07:14 AM
Object reference Error mrideout BOOK: Beginning ASP.NET 1.0 4 August 9th, 2004 07:29 AM
Object reference error shaileshmark SQL Server 2000 2 July 22nd, 2004 03:13 PM
Error: 'style.display' is null or not an object Adam H-W Javascript 4 April 22nd, 2004 08:45 AM



All times are GMT -4. The time now is 05:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.