473,761 Members | 9,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Menu items keep disappearing

Hi all

In my login form (forms authentication) I check that the login is valid,
retrieve an "Author" object, and keep track of the author's roles.

string[] roles;
if (author.IsAdmin istrator)
roles = new string[] {"Admin", "Member"};
else
roles = new string[] {"Member"};
Cache.Add(autho r.UniqueId, roles, null, DateTime.MaxVal ue,
TimeSpan.FromHo urs(1), CacheItemPriori ty.BelowNormal, null);
In my Global.asax.cs file I execute the following code in order to ensure
that the author's roles are available to forms authentication. ..

protected void Application_Aut henticateReques t(Object sender, EventArgs e)
{
if (HttpContext.Cu rrent.User != null)
{
IIdentity userId = HttpContext.Cur rent.User.Ident ity;
//Do we have some roles to retrieve? If so, replace the user object
if (HttpContext.Cu rrent.Cache[userId.Name] != null)
{
string[] roles = (string[]) HttpContext.Cur rent.Cache[userId.Name];
HttpContext.Cur rent.User =
new System.Security .Principal.Gene ricPrincipal(us erId, roles);
}
}//user != null
}
The problem I have is that the host site seems to keep changing its mind as
to whether or not my login has the "Admin" role or not.

<location path="Admin">
<system.web>
<authorizatio n>
<allow roles="Admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>

Whenever I am navigating my way around within the /Admin folder, I will
(apparently randomly) be redirected to the Login page as if I were not an
Admin, or not authenticated. However, refreshing the /Admin/whatever.aspx
url repeatedly will eventually allow me to continue.

This fact is reflected in my menu control. I have an "Administration "
section which is displayed/hidden depending on

HttpContext.Cur rent.User.IsInR ole("Admin");

Repeatedly refreshing any page at all, including a page with no
restrictions, will (apparently randomly) show/hide the Administrator menu
items.

Can anyone shed some light onto this behaviour? The last point made seems
to indicate that the user identity is being lost somehow.

Thanks
--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
Nov 19 '05 #1
1 2271
Just thought I'd mention the solution.

It would seem that the Cache[] was not consistent between requests because
of the pooling type set within IIS. Setting it back to "pooled" seems to
have done the trick.
--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
Nov 19 '05 #2

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

Similar topics

4
3844
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
1
4332
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i want to make first text as Table Heading/menu category. For examle in the given menu i want to make a heading as "Comp. Languages" which won't be a link. 2) The position of this menu is absolute to the page. I want to make it absolute to the Table...
0
1864
by: bubbagump | last post by:
Hey hey.... Need some help with CSS menus. I need to figure out how to keep my main menu items highlighted when I am hovering on sub-items or sub-sub-items. Here is my code: #menu { width: 161px; }
0
1285
by: kinane3 | last post by:
Mostly I need to figure if I'm wasting my time or if there is a way to do what I am trying to do. I am an intermediate to CSS at best so please don't flame me, just trying to do my job here. I came across this article when I searched for a CSS solution to long winded DHTML dropdown menus. http://www.alistapart.com/articles/dropdowns/ I did get it to work but here's my problem. What I "did" get to work was a horizontal drop in a...
2
1857
by: Greg | last post by:
I wonder if someone would help me and take a look at a strange problem I'm facing with a webpage I'm building. The page is at http://author.www.purdue.edu/swo/test.html. By using Internet Explorer v6, you will see the problem I'm having (so far I've tested this page only in IEv6, FF2 and IE7). If you click on the navigation menu on the left side (Alcohol, Tobacco & Other Drugs, General Wellness, Nutrition, etc.), the menus expand. ...
2
5908
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set of context menu items. Thanks.
4
9296
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me if it works, and if it does not, tell me why it does not work. Thanks.
1
2518
by: Kayvine | last post by:
Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to start it and what main topics in C I will need to cover in the assignment. Thanks a lot. CSC180 Assignment #3: Menu Madness Due Date: Thursday, November 8th at 1:00am Contents: · General Info · What to Hand In o Submission Instructions
0
9554
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
9376
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9988
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9811
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...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
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
5266
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...
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
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.