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

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.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 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="CustomTrust" 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_minimaltrust.config from the framework CONFIG
directory to the Website directory and renamed it
- I then added [assembly: AllowPartiallyTrustedCallers] and [assembly:
SecurityCritical] in the assemblyInfo file for the custom provider.
- I added a permission set to the custom.config file. It is like this -
<PermissionSet
class="NamedPermissionSet"
version="1"
Name="MyCustomPermissionSet"
Unrestricted="true"
Level="CustomTrust"
Description="My custom permission set">
<IPermission
class="SecurityPermission"
version="1"
Flags="Execution, Assertion"
/>
<IPermission
class="SqlClientPermission"
version="1"
Unrestricted="true"
/>
</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="UnionCodeGroup"
version="1"
PermissionSetName="MyCustomPermissionSet"
Description="Custom code group for my signed
assembly">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="Public key blob from the
strong name key pair"
/>
</CodeGroup>
- I added [SecurityCritical] in front of all the methods that are
implemented
- I added following code in all the methods
SecurityPermission permission1 = new
SecurityPermission(PermissionState.Unrestricted);
permission1.Assert();

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.Security.Permissions.SecurityPermission,
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 2086

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

Similar topics

6
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...
15
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...
5
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...
4
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...
0
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...
7
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....
0
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...
0
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...
6
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.