Masterpage #2

Is it possible to create multiple masterpages in a web application? From your last comment, it sound like it can be done. What I am trying to accomplish here is, I want to create an intranet, two seperate Masterpage, one will be used by users, and second will be used by admin. The season is that I want to hide part of links ( I will use Sitemap) from users. Or what do you think I should do instead?  

Open in new window

VBdotnet2005Asked:
Who is Participating?
 
Munawar HussainConnect With a Mentor Principal Software EngineerCommented:
Here is example how to use that ..
 If User.IsInRole("Administrators") Then
            ' Do something only admins are allowed to-do
' you may redirect to relavent page
        End If
This works great from within ASP.NET pages.  Non-page derived classes dont have a built-in User object.  However, you can always access an ASP.NET Requests User identity context using code like this:
        Dim User As System.Security.Principal.IPrincipal
        User = System.Web.HttpContext.Current.User
        If User.IsInRole("Administrators") Then
            ' Do something only admins are allowed to-do
        End If

HERE IS EXAMPLE FOR THAT

http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx
0
 
Munawar HussainPrincipal Software EngineerCommented:
then you can do that ..
Create masterpage for users and make parent of login page.
so every user for login comes to this page and see the public links only
Default.aspx //this page uses master page mspUsers
on click of login button check if user is Admin then

Redirec to
Admin.aspx // this page uses master page mspAdmin


Thanks
0
 
VBdotnet2005Author Commented:
There won't be a login page. I am planing to use their windows login instead. I am using one of my XP pro to host this intranet app.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
VBdotnet2005Author Commented:
Do you think I should check to see if, let says, Joe is an admin, redirect him to admin.aspx, and if not joe then redirect to user.aspx?
0
 
Munawar HussainPrincipal Software EngineerCommented:
Instead you check every user for username .. you may have users mapped to Roles .. if is in Admin Role then redirect to Admin.aspx..
yes that make sense..
if it you feel any difficulity in doing that then can look on alternate options too.

thanks
0
 
VBdotnet2005Author Commented:
Greate sample. Is above link use File System or HTTP(required virtual directory)?
0
 
Munawar HussainPrincipal Software EngineerCommented:
Is there any issue you are getting with File System based or Virtual Dir based?
Thanks
0
 
VBdotnet2005Author Commented:
I followed to step # 3, as you suggested above link,  when I logged in as a user at work, he still get the windows logon popped up. I have SQL Express installed and running fine.
0
 
Munawar HussainPrincipal Software EngineerCommented:
First thing .. for development you may use builtin server that comes with VS2005 but to access from network (other computers) you must deploy under IIS (Virtual directory) because light weight server (based on cassani) is just for development and dont have all facilities required for website hosting..
Thanks
0
 
VBdotnet2005Author Commented:
IIS is installed on my XP pro. That would still be a problem?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.