MVC3 - Roles seem to get evaluated differently on different machines

Posted on 2013-09-24
Medium Priority
Last Modified: 2014-02-15

I'm developing an mvc3 site which uses .net membership provider.  There are 3 roles and "all works fine on my machine".

One of the pages which has [Authorize(Roles = "member")] delivers video content.  The video is served from a separate controller which checks to see if the requested video should be served to the user based on their role.  This is evaluated by:
{... deliver file...}

Open in new window

Some vids are public, some are only for members, some only for the higher membership level etc - "all works fine on my machine".

Previously this worked fine for my customer but he is now finding that the public vids play for him but any role-validated vids are not rendered.  I've checked his user and he has all 3 roles assigned.  If I login with his user then I can view all vids no problem.  

I created a test page to display each role and show if the current user is in that role.  He viewed that and it showed he's assigned to each role.  Then the vids started working for him on one of his machines - on another it made no difference.

What could be causing this?  Some kind of role-cacheing issue perhaps?  Could viewing the new test page (which requires login) have forced the server to recreate the authentication cookie for him?

My roleManager declaration in web.config looks like this:
<roleManager enabled="true">

Open in new window

Do I need to specify additional attributes for roleManager in web.config to solve this issue?
Or do I need to evaluate the user's role membership some other way in the controller that serves the video files?

Thanks for advice.
Question by:Danzigger
  • 2
LVL 41

Accepted Solution

guru_sami earned 2000 total points
ID: 39523133
By default the roles aren't cached.
On the client's second machine where it didn't work, did it display the roles on the page?

Assisted Solution

Danzigger earned 0 total points
ID: 39848875
I had accidentally hard-coded a preview URL into the script that validates the role.  The user was authenticated on the domain they were browsing under, but not authenticated on the domain that was validating access to the video.  Duh!

Very sorry for wasting your time but thanks for the info anyway!

Author Closing Comment

ID: 39861170
The question wasn't really valid as it stemmed from a fundamental configuration error that I made.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Native ability to set a user account password via AD GPO was removed because the passwords can be easily decrypted by any authenticated user in the domain. Microsoft recommends LAPS as a replacement and I have written an article that does something …
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…

621 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