473,395 Members | 1,969 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,395 software developers and data experts.

Losing user roles

I am baffled, I am using a treeview to set the source of an iframe. The web page is being displayed correctly, but User.IsInRole("roleName"), in the code behind, always returns false. The strange thing is User.Identity.Name returns the correct user name. I have tried setting the target of the tree view nodes to "_blank" and to "_self" and still no luck. So, it doesn't appear that the problem is related to the iframe.

Before the treeview was added, javascript was used to set the source for the iframe and User.IsInRole returned the correct values.

Any ideas?
Aug 11 '10 #1
4 1343
Frinavale
9,735 Expert Mod 8TB
Authentication cookies are used to associate a browser with a particular user in your system. IFrames are a little weird in that they act like "embedded windows". They may not share the same cookies and this could be the reason for why you have having problems.

I'm not 100% sure how IFrames will work in this regard.

If I were you I'd avoid IFrames. They have their applications but by the sounds of it you would benefit from converting your "Pages" into "Web User Controls" and use the TreeView to hide/show the user control selected.

-Frinny
Aug 11 '10 #2
Thanks! I still have the problem when I don't use the iframe, but display the page in a popup or in the same window. And I didn't have a problem when Javascript sets the source of the iframe. The treeview must be the culprit. Is there anything that a treeview does that would cause User.IsInRole() to always return false?
Aug 11 '10 #3
Frinavale
9,735 Expert Mod 8TB
Something weird is going on.
Are you using any custom authentication features?

-Frinny
Aug 11 '10 #4
Just using forms authentication with a roles list retrieved from a SQL database. User.IsInRole() does work in the main page. I did a test which added the user roles to each url in the treeview, for example: ?roles=RW (for Read, Write) and the URLs are correct. They contain the user's roles retrieved from User.IsInRole().
Aug 11 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vic | last post by:
I am trying to build a site where users, after signing up for services can download some software. There is also a trial version of software which doesn't require any user authentication. I...
1
by: | last post by:
Hello Guys, I would like to know if ASP.NET has any "automated tools/ API" to manage content personalization based on user roles? Rather than using user's login to retrieve information from...
2
by: naijacoder naijacoder | last post by:
Hi All, Any ideas on how to create a dynamic TreeView Menu with user roles.For example binding XML to Treeview or populated from DataBase.. Thx *** Sent via Developersdex...
1
by: Charles | last post by:
Hello, I tried posting this yesterday, and I have not seen it yet this morning. Thinking that something went wrong getting this question posted I am posting it again. Sorry if this does end up...
0
by: Trollpower | last post by:
Hello NG, Ive got authentication mode Forms activated in web.config. Now I have also 2 pages. Page 'A' needs role '1' to be accessed while page 'B' needs role '2' to be accessed. When the user...
0
by: opelit | last post by:
Hi! I am a new User for C#.Net 2.0 I got how to use Login controls. Now i want to create User Roles, Admin, Editor and Viewer and assign to the Users created. How to create these roles? ...
2
by: mark4asp | last post by:
This is a simplified version of my site. There are Premium users who have access to the Premium directory. Anyone else attempting to access it should be logged and then redirected to the...
2
by: Jonathan Wood | last post by:
I've set up ASP.NET membership. I can get the role(s) of the current user by calling Roles.GetRolesForUser(). It seems like it would be a good idea to store some role-specific calculations in...
1
by: TheEarthWillShake | last post by:
I'm creating a web app that will have 3 user roles. Admins (Can view all) Project Managers (only view ProjMan folder) Readers (Only view Reader folder) The way I want to log users onto the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.