Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 2nd, 2010, 05:40 PM
Registered User
 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 - HasAccessToMenu method issue

Hi,

I was able to follow until Chapter 6. When I compile my project, it keeps complaining about NullReferenceException in the following section of the HasAccessToMenu method in ENTMenuItemBO.cs class:

public bool HasAccessToMenu(ENTUserAccountEO userAccount, ENTRoleEOList roles)
{
if (IsAlwaysEnabled)
{
return true;
}
else
{
//Loop through all the roles this user is in. The first time the user has
//access to the menu item then return true. If you get through all the
//roles then the user does not have access to this menu item.
foreach (ENTRoleEO role in roles)
{
//Check if this user is in this role
if (role.RoleUserAccounts.IsUserInRole(userAccount.ID ))

I confirmed that Windows Authentication is turned on and anonimous access is disabled. I also confirmed that userAccount = domain/myusername and my db has the exact same data as the download sql code.

Any help would be appreciaited.
Reply With Quote
  #2 (permalink)  
Old September 11th, 2010, 11:33 AM
Authorized User
 
Join Date: Jul 2010
Posts: 27
Thanks: 2
Thanked 0 Times in 0 Posts
Default Hi

Hi

I have finished ch 6 but i can not view the side menu at all.

Cab you view the side menu when you click on the admin tab?

have you notice in the original code the following lines in the web.config

Code:
<add name="LocalSqlServer" connectionString="Data Source=VARALLO1;Initial Catalog=PTOPersonalization;User ID=V2Application;Password=wrox" providerName=""/>
    <add name="HRPaidTimeOffConnString" connectionString="Data Source=VARALLO1;Initial Catalog=HRPaidTimeOff;User ID=V2Application;Password=wrox" providerName=""/>
There is no such catalog PTOpersonalization in the code. And also could you explain me how do you make V2Application work on your machine.
I think this a sort of filter of memeber roles that has something to do with the side menu when an account tries to access the database and then the application.

If you could help it would be much appriciated.

matt
Reply With Quote
  #3 (permalink)  
Old September 12th, 2010, 06:03 PM
Registered User
 
Join Date: Aug 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was able to figure out what's wrong with my code. In the admin page, I forgot to initialize Roles.

Regarding your question, I modified webconfig and db to use my custom-db.
However, when I tried the sample code, it was working with no problem. Only thing I changed was to use windows authentication in the webconfig (not sql authentication).
Reply With Quote
  #4 (permalink)  
Old November 16th, 2011, 10:38 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default NullReferenceException error on foreach (ENTRoleBO role in roles)

hi booze,

may i know how do you initialise the Roles in admin page.

I get NullReferenceException error on foreach (ENTRoleBO role in roles)

Anyone, pls advise... stuck in chp 6
Reply With Quote
  #5 (permalink)  
Old November 17th, 2011, 11:03 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Probably due to wrong configure in exception handling chp 5

skip chp 5 and manage to get chp 6 done.
no more NullReferenceException error
Reply With Quote
Reply


Thread Tools
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
Functions, Chapter 3 Building a Method bodycode BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 0 November 25th, 2009 05:23 PM
about chapter 7 requestLocationUpdates method stacychou BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 May 1st, 2009 10:52 AM
More Chapter 3 Method questions. wbrco BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 3 February 16th, 2009 11:14 PM
Chapter 12 Web Method syntax VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 February 23rd, 2006 12:46 PM



All times are GMT -4. The time now is 11:10 AM.


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