Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2006, 03:21 PM
Authorized User
Join Date: May 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically changing Master Pages (Forms Auth)

In the traditional "completely backwards" style, I have now decided that the site I am doing needs to be fitted into master pages. Good idea, but the implementation has been a bit rough. In its basic form, things are going well, I have no problem referencing which master page to use, and items show up in the appropriate spots. However, one of the areas of my master page will be used to display a list of links, or more appropriately, user options. After checking the database, it will be determined which links will be shown depending on the rank of the user visiting the site. (Other security measures are used of course, but this is just from a usability standpoint)...
My original thought was just to do this checking in the masterpage.vb file. Then, I could switch visibility of the appropriate panels on or off. But, even though I am using forms authentication, I get errors that "User" is undefined (I commonly use User.Identity.Name throughout the site)... From this point I really don't know where to go-- I attempted to do the checking in the content page's .vb file and then just reference a panel within the master page...
Dim thisPanel As Panel = CType(Master.FindControl("adminPanel"), Panel)
Of course, this comes back as Object reference not set to an instance of an object... hmm.

So, short of stuffing the links into this content section dynamically (doing the checking in every single content page and copying and pasting), I am not sure what will work for me... I know this solution is not the best, so I am trying to avoid it.

It seems very close, I just need to know what I am missing, or at least how to manipulate items in a master page via a content page! (or how to access my all-important User.Identity.Name variable!)

Reply With Quote
  #2 (permalink)  
Old July 4th, 2006, 05:18 AM
Registered User
Join Date: Jul 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to itamar82 Send a message via MSN to itamar82

what about using a web control instead?

Reply With Quote
  #3 (permalink)  
Old July 11th, 2006, 08:49 AM
Authorized User
Join Date: May 2006
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts

quote:Originally posted by itamar82
 what about using a web control instead?

...how so?... I am still a bit new to these things.

Reply With Quote
  #4 (permalink)  
Old July 16th, 2006, 10:59 PM
Friend of Wrox
Join Date: Apr 2005
Location: Fort Walton Beach, FL, USA.
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts

You need to investigate directives, in this case specifically:
<%@ MasterType VirtualPath="~/MasterPage.master" %>
assuming your masterpage is named: MasterPage.master.


Reply With Quote

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
Master Pages Jayahar ASP.NET 3.5 Basics 1 September 2nd, 2008 04:20 PM
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
Master pages wunnavabk ASP.NET 2.0 Professional 1 June 25th, 2007 07:09 AM
Forms Auth and Roles ~Bean~ ASP.NET 2.0 Professional 1 August 22nd, 2006 11:35 AM
ASP.NET Forms Auth security problem englere BOOK: ASP.NET Website Programming Problem-Design-Solution 0 October 6th, 2004 03:49 PM

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

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