473,831 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RoleProvider question -- help please (.NET 2.0)

Hello,

I derived a custom provider from the provider class. I set

cookieless="Use Uri"

in the web.config, because we don't want data stored on client
machines.

Now, as I understand it, the information from the Membership Provider
gets serialized and saved on the url, but the same does not apply to
the RoleProvider info.

Everytime a page with <asp:loginvie w> is called, the Role Provider page
gets called and the database gets queried, whereas the database does
not need to be queried again for user info by the Membership Provider,
since the info is saved on the url.

I tried to save the roles() as a session variable in the Role Provider
page but since that page is a vb class, it does not recognize the
Session class.

How can we save the roles() info so that we don't have to call the Role
Provider each time to figure out the roles assigned to a user?

Thanks,

Burak

Mar 21 '06 #1
4 1348
On 21 Mar 2006 06:05:10 -0800, Burak Gunay wrote:
How can we save the roles() info so that we don't have to call the Role
Provider each time to figure out the roles assigned to a user?


By default, asp.net caches the roles for the current user, so it will call
your providers GetRolesForUser () method once and only once for the session,
after that it will return cached results.
Mar 21 '06 #2

Erik,

Are you sure about that? I have the following setting in my web.config

<membership defaultProvider ="MyMembershipP rovider">
<providers>
<clear/>
<add name="MyMembers hipProvider"
type="MyMembers hipProvider"></add>
</providers>
</membership>

and it calls the GetRolesForUser () method every time a page with a
loginview control comes up.

When I set the cookies on as follows

<roleManager defaultProvider ="MyRoleProvide r" enabled="true"
cacheRolesInCoo kie="true"
cookieName=".AS PXROLES"
cookiePath="/"
cookieTimeout=" 30"
cookieRequireSS L="false"
cookieSlidingEx piration="true"
createPersisten tCookie="false"
cookieProtectio n="All" >

then it calls GetRolesForUser () only once.

Burak

Mar 22 '06 #3
On 22 Mar 2006 06:13:56 -0800, Burak Gunay wrote:
Erik,

Are you sure about that? I have the following setting in my web.config
....
and it calls the GetRolesForUser () method every time a page with a
loginview control comes up.


Correct. It has to call GetRolesForUser the first time (ie, when he logs
in), but after that, whenever UserPrincipal.I sInRole is called, it uses the
cached version.
Mar 22 '06 #4
On Wed, 22 Mar 2006 13:52:59 -0600, Erik Funkenbusch wrote:
On 22 Mar 2006 06:13:56 -0800, Burak Gunay wrote:
Erik,

Are you sure about that? I have the following setting in my web.config


...
and it calls the GetRolesForUser () method every time a page with a
loginview control comes up.


Correct. It has to call GetRolesForUser the first time (ie, when he logs
in), but after that, whenever UserPrincipal.I sInRole is called, it uses the
cached version.


Sorry, I reread this and realized you were talking about something else. I
haven't looked at the LoginView control yet, but it may be calling
GetRolesForUser () directly rather than using IsInRole
Mar 22 '06 #5

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

Similar topics

7
3629
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
1
2339
by: Mark Olbert | last post by:
I've written a custom MembershipProvider and a custom RoleProvider, and am trying to get them to work with the ASP.NET Configuration tool. Which is a royal pain in the butt, because there doesn't appear to be any way to debug the Configuration tool. In any event, when I create a new user I get the following error message: An error was encountered. Please return to the previous page and try again. The following message may help in...
0
1428
by: Mark Olbert | last post by:
I'm posting this here to save other folks some hair-pulling time. No need to respond. You can debug custom MembershipProvider and RoleProvider classes under the ASPNET Configuration tool by attaching the debugger to the server process which generates the configuration web pages. Once you've done that you can set breakpoints in your custom classes and stop on them. You can also single-step into the configuration pages themselves. - Mark
6
1372
by: =?Utf-8?B?Q2h1Y2sgUA==?= | last post by:
I have a Role Provider with a subdirectory protected via the web.config. Forms authentication is used. If a person who is not in the role tries to access a page in the directory, the browser is redirected to the forms authentication logon page. Is there a way to prevent this behavior? I would prefer to just show the user an access denied page and maybe some help text. Maybe some events fire in the provider model or the global.asax?
8
5293
by: Tomasz | last post by:
Hello Developers! I have an interesting problem using my custom MembershipProvider, RoleProvider and Forms Authentication. Both MembershipProvider and RoleProvider require session state, where some very important context data are stored during the Session_Start event. My MembershipProvider and RoleProvider depend on this information. It seems that authentication process works with no problems.
1
1722
by: Arthur Dent | last post by:
Please help... i am stumped... I have an app, written in VB.NET fwiw. I have a custom RoleProvider class, cuz i finally got tired enough of hacking with application variables, to learn the "correct" way to do roles. ;) .... Now, the problem, is that my RoleProvider, and my FormsAuthentication Session do not stay together. That is to say, i frequently see cases where the session will expire, but the RoleProvider does not. Now, they...
0
1012
by: caius | last post by:
Hi, I recently develop a custom membership provider and role provider . I did configure the central admin and the SharePoint site to use them. I can now use the login page and authenticate to SharePoint when the user is listed as a member of the site, when it is not listed as a member but is in a role it never works. When I attach visual studio and try to authenticate, I see the user getting through the validateUser on my membership...
2
2328
by: =?Utf-8?B?d2lsbGlhbQ==?= | last post by:
Hi, Could anyone tell me how to change the default roleprovider at runtime? Basically I have a few sets of roleprovider and membership provider, I want to switch among them at runtime based on some sort of identifier. Thanks. William
0
9793
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
9642
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
10777
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...
0
9317
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...
1
7748
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
5619
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...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3963
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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.