473,770 Members | 5,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom provider in partial trust mode

Hello,

I am developing a custom membership provider. For that I built a prototype
that uses a SQL Server 2005 database as a backend store. I implemented the
class System.Web.Secu rity.Membership Provider and implemented few necessary
methods. The methods use SQL for interacting with the SQL Server database. I
put all this code in a class library.

I also created a simple Website using Visual Studio 2005 and configured the
Web.config to use this custom provider that I have written. Everything
worked fine. I could use the ASP.NET configuration tool and use the custom
provider to add users and view user details. Then I added a login page with
a login control and create user page with create user control and both of
them worked.

Now, I want to run this provider in the partial trust environment since MOSS
2007 runs in Minimal trust mode. I followed instructions provided in some of
the articles that I found on the web. Basically, the steps I took were
- Add a line <trust level="CustomTr ust" originUrl=""/in the Web.Config
for the website I created.
- Add a security policy in the same Web.config. This policy associates the
trust level specified above with the config file.
- I then copied web_minimaltrus t.config from the framework CONFIG
directory to the Website directory and renamed it
- I then added [assembly: AllowPartiallyT rustedCallers] and [assembly:
SecurityCritica l] in the assemblyInfo file for the custom provider.
- I added a permission set to the custom.config file. It is like this -
<PermissionSe t
class="NamedPer missionSet"
version="1"
Name="MyCustomP ermissionSet"
Unrestricted="t rue"
Level="CustomTr ust"
Description="My custom permission set">
<IPermission
class="Security Permission"
version="1"
Flags="Executio n, Assertion"
/>
<IPermission
class="SqlClien tPermission"
version="1"
Unrestricted="t rue"
/>
</PermissionSet>
- I then created a strong name key pair file and added it to the custom
provider project and referenced it in that project.
- I added a Codegroup section in the custom.config file as follows
<CodeGroup
class="UnionCod eGroup"
version="1"
PermissionSetNa me="MyCustomPer missionSet"
Description="Cu stom code group for my signed
assembly">
<IMembershipCon dition
class="StrongNa meMembershipCon dition"
version="1"
PublicKeyBlob=" Public key blob from the
strong name key pair"
/>
</CodeGroup>
- I added [SecurityCritica l] in front of all the methods that are
implemented
- I added following code in all the methods
SecurityPermiss ion permission1 = new
SecurityPermiss ion(PermissionS tate.Unrestrict ed);
permission1.Ass ert();

Now I am trying to run the ASP.NET configuration tool and it gives an error
"This feature is not supported at the configured trust
level".

If I raise the trust level to 'Medium', everything works. If I lower it to
'Low', I get a different error, something about mscorlib. "Request for the
permission of type 'System.Securit y.Permissions.S ecurityPermissi on,
mscorlib, Version=2.0.0.0 .... failed".

First of all, do I have to run the custom provider in the minimal trust
level? I am doing this because I read that MOSS 2007 expects it to run in
partial [minimal] trust mode.

Where am I going wrong? I could not find anything on the web that will help
me solve this problem. So, any help is really appreciated.

Thanks,

Atul.

Jun 29 '07 #1
0 2119

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

Similar topics

6
2686
by: serge calderara | last post by:
Dear all, Does any one have any idea why an sql statment with INNER JOIN syntax is working well with odbcprovider but not with Oledbprovider when accessing an access 2000 database? here is the code I have used with oledbprovider which fails Dim monodbc As New OleDb.OleDbConnection 'Odbc.OdbcConnection
15
2293
by: Thomas Christmann | last post by:
Hi! I have a rather special question here. I'd like to write a wrapper for a .NET assembly, and register that on my server so that the people on my server call my assembly instead of the standard .NET assembly. Reason is that I want to include some additional security checks in my assembly, to prevent everybody from the calling the .NET assembly unchecked. So, writing the wrapper is no problem, but I'm not sure how/if it is possible to...
5
2557
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called "Enlighten.LinkMad.Businesslogic". In one of my frontend websites I use this type to authenticate a user who is trying to login. The following excerpt is from the web.config of the particular site showing the reference to the custom provider, allowing .Net to do...
4
2791
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying the MasterType directive on the aspx form. My master page will render a custom navigation menu and I'd like to put in the properties of which tab and sub tab to load and other misc style info in the aspx form that can be used by master page.
0
1905
by: OceanBreeze | last post by:
I have added a LinkButton to a table cell programmatically inside the Page_Load method. I also added a custom event to that link button. The same custom event is valid for all the link buttons. The table gets successfully displayed on the browser with the LinkButton. When I click on the link button in the browser, my control does not go inside the custom even that I wrote for the link button. I have a table control as ProviderTbl in which...
7
3936
by: Tom Van den Brandt | last post by:
Hi all! I'm trying to implement a custom roleprovider in asp.net. The new roleprovider works fine when I access it programmaticaly. However, it doesn't seem to work with the standard controls. More specifically, I have a loginview with rolegroups and the parts of the site that should be viewable for a certain role, do not show up. Did I forget something? Regards,
0
1279
by: arturbl | last post by:
I just finished my sort of MVC/P framework where I do url rewriting. During the url rewriting I access properties of the controller/presenter based on the url. First thing that most of us would probably do is to use reflections to dynamically acess properties of the controller on the run-time. Not possible with reflections in the partial trust environment on shared host !! So I switched to methods of System.ComponentModel and use right...
0
953
by: Atul Thombre | last post by:
Hello, I am developing a custom membership provider. For that I built a prototype that uses a SQL Server 2005 database as a backend store. I implemented the class System.Web.Security.MembershipProvider and implemented few necessary methods. The methods use SQL for interacting with the SQL Server database. I put all this code in a class library. I also created a simple Website using Visual Studio 2005 and configured the Web.config to...
6
2933
by: Jonathan Wood | last post by:
Although this will be a challenge at my level of ASP.NET knowledge, I'm thinking I should implement my own membership provider class. Looking over the methods I must implement, a number of questions come to mind. 1. How would one implement GetNumberOfUsersOnline? I'm not sure where there is any indication of this? And it this affected by the "Remember me next time" checkbox, which doesn't seem to work like it does on any other site...
0
9591
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
9425
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
10225
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
10053
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
9867
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...
0
8880
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...
0
5312
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.