473,785 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

roles and dynamic sitemaps based on session variable

Hi All,

I have an ASP .NET 2.0 web based app which should change content based
on a variable passed in the query string. Let's say the variable is
called ID and the variations are A, B and C. I put this value into a
Session variable and make changes based on that.

The website needs to provide authorisation based on roles. I was
planning on using the roles and authorisation techniques introduced by
2.0. A, B and C each have their own subset of roles e.g.

For A:
AdminA, UserA, ReadOnlyA

For B:
AdminB, UserB, ReadOnlyB

For C:
AdminC, UserC, ReadOnlyC

So if a user called Joe who is a member of UserA accesses the website
but the session variable is C, then Joe shouldn't have access to the
website. Considering that there doesn't seem to be any relationship
between session and roles, how do I implement this? Can it be done?

Also, I use a sitemap to create a menu of content. Some sitemap nodes
should be visible only to AdminA, AdminB and AdminC. How do I make
sure that this occurs considering these roles are based on a session
variable? I know you can set an attribute for each sitemap node to use
the roles and authorisation in 2.0, but when the role is based on a
session variable how do I mke this work? Do I need to dynamically
create the site map?

Dec 5 '06 #1
1 2556
FYI I managed to work out how to implement roles based on the Session
variable by essentially doing:

Session["ID"] = Response.QueryS tring["ID"]

If(User.IsInRol e("Admin" + Session["ID"].ToString()))
{ //provide access }

The issue now is simply getting the sitemap to change what it shows
based on these roles. I know you can set the attribute in the XML at
the sitemap node level to restrict access, but when my "roles" are
being dynamically determined, I'm not sure what to do.

Seeing as a sitemap is essentially XML, do I need to dynamically create
them?
je****@gmail.co m wrote:
Hi All,

I have an ASP .NET 2.0 web based app which should change content based
on a variable passed in the query string. Let's say the variable is
called ID and the variations are A, B and C. I put this value into a
Session variable and make changes based on that.

The website needs to provide authorisation based on roles. I was
planning on using the roles and authorisation techniques introduced by
2.0. A, B and C each have their own subset of roles e.g.

For A:
AdminA, UserA, ReadOnlyA

For B:
AdminB, UserB, ReadOnlyB

For C:
AdminC, UserC, ReadOnlyC

So if a user called Joe who is a member of UserA accesses the website
but the session variable is C, then Joe shouldn't have access to the
website. Considering that there doesn't seem to be any relationship
between session and roles, how do I implement this? Can it be done?

Also, I use a sitemap to create a menu of content. Some sitemap nodes
should be visible only to AdminA, AdminB and AdminC. How do I make
sure that this occurs considering these roles are based on a session
variable? I know you can set an attribute for each sitemap node to use
the roles and authorisation in 2.0, but when the role is based on a
session variable how do I mke this work? Do I need to dynamically
create the site map?
Dec 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1662
by: Keith | last post by:
I have a SQL DB with a number of tables and queries (views) in. In front of this is my ASP app I am designing. When my users log in, their User ID is stored in a session variable. One of the views determines which User ID can access which records, and obviously then I want to base all my app around this so that a user can only ever be working on data relevant to them.
7
7226
by: Billy Jacobs | last post by:
I am having a problem with my session variable being set to Null for no apparent reason. I am declaring it like the following when the user logs in. dim objUserInfo as new clsUserInfo 'Set some properties objUserInfo.UserName = txtUserName.text.trim objUserInfo...
2
3385
by: John Holmes | last post by:
I have a web interface where the user types in ID's one at a time. After an ID is typed in, a button is clicked and the button click event has code that does a query and returns a data reader and then appends the data to a dataset that is built in the Page_Load code in the if(!isPostBack) block. When I try to add a row in the button click event code I get an error saying that "Object reference not set to an instance of an object". I'm...
2
6166
by: Joe Molloy | last post by:
Hi, This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious. I have developed a shopping cart for an application I'm working on which is loosely based on the e-commerce example in the quickstarts tutorial. In the cart display I have provided functionality so that when a user clicks on a product name a popup is opened with the full product details displayed.
2
2500
by: +The_Taco+ | last post by:
I already use session variable in my project to set a session timeout when the user doesn't do anything for 10 minutes. When I call other pages, I often use parameters in HREF link. I was wondering if it was better to pass parameter from page to page as session variable instead of doing it in HREF link? Thx for the hint !
13
13352
by: Nagib Abi Fadel | last post by:
Is it possible to create a session variable for each user in Postresql ?? Thx
2
3404
by: Mirovk | last post by:
Hi, I have a session variable wich value arrives from a previous .asp but in my actual page I need to modify it based upon a selected value from a radio button. I will try to figure out for better understanding: page1.asp ---session("PaymentMethod") page2.asp ---Depending on the radio button selected the payment
13
3071
by: SAL | last post by:
Okay, don't bash me to hard for my design on this app, it's my first web app and it's in production. My basic design is using Datatables created via the designer with a business logic class in between the datatable and ObjectDataSources. In one page I had a Gridview with select enabled. When an row in the grid is selected, I retrieve the SelectedValue, store the value in a Session variable and redirect the response to another web page,...
4
5327
by: Bjorn Sagbakken | last post by:
In a web-application with login creds (user, pwd), these are checked against a user table on a SQL server. On a positive validation I have saved the userID, name, custno and role-settings in a userobject (custom build class) and added this to the session using as session variable like session For all other pages I have added a small test in the page_load event, basically testing if the session != null, but also checking if the...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.