Solved

Masterpage #2

Posted on 2007-11-30
10
561 Views
Last Modified: 2012-06-21
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

0
Comment
Question by:VBdotnet2005
  • 5
  • 5
10 Comments
 
LVL 12

Expert Comment

by:needo_jee
ID: 20387259
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
 

Author Comment

by:VBdotnet2005
ID: 20387266
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
 

Author Comment

by:VBdotnet2005
ID: 20387273
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 12

Expert Comment

by:needo_jee
ID: 20387296
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
 
LVL 12

Accepted Solution

by:
needo_jee earned 500 total points
ID: 20387308
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
 

Author Comment

by:VBdotnet2005
ID: 20388948
Greate sample. Is above link use File System or HTTP(required virtual directory)?
0
 
LVL 12

Expert Comment

by:needo_jee
ID: 20389918
Is there any issue you are getting with File System based or Virtual Dir based?
Thanks
0
 

Author Comment

by:VBdotnet2005
ID: 20390410
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
 
LVL 12

Expert Comment

by:needo_jee
ID: 20390466
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
 

Author Comment

by:VBdotnet2005
ID: 20390489
IIS is installed on my XP pro. That would still be a problem?
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question