473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 2540
FYI I managed to work out how to implement roles based on the Session
variable by essentially doing:

Session["ID"] = Response.QueryString["ID"]

If(User.IsInRole("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.com 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
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...
7
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...
2
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...
2
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...
2
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...
13
by: Nagib Abi Fadel | last post by:
Is it possible to create a session variable for each user in Postresql ?? Thx
2
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...
13
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...
4
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...

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.