medium-trust

What Reflection Permission are allowed in Medium Trust?

蓝咒 提交于 2019-12-10 03:32:10
问题 I want to ask that which methods/classes are allowed in Medium Trust. For example, whether these methods are allowed? GetProperties, GetMethods, Activator.CreateInstance, Assembly.Version, AssemblyName.Name Please tell me which methods are allowed. 回答1: GetMethods and Activator.CreateInstance should be allowed IIRC, whilst AssemblyName and Assembly.Version aren't. I've used the first two methods in Medium-Trust environments and the latter two didn't work. Best way is just through trial-and

How to determine if the current application is Medium Trust

99封情书 提交于 2019-12-09 12:50:33
问题 I am trying to make sure my ASP.Net library will work under Medium Trust. I'm having problems however in that I need to disable a bit of code if it is being run under medium trust. How do I determine from C# if the current application is medium trust? Specifically, I'm trying to read the customErrors section from web.config and I'm getting security errors 回答1: This article here describes a mechanism to determine the trust level: Finding out the current trust level in ASP.NET Here is the code

Expression<TDelegate>.Compile in Medium Trust environment

风流意气都作罢 提交于 2019-12-08 17:28:17
问题 When trying to compile an Expression in a medium trust web app I'm getting a MethodAccessException. Does anyone know of another way to compile an expression under medium trust or a workaround to avoid this exception? The code that throws the exception: Expression<Func<object>> efn = Expression.Lambda<Func<object>>(Expression.Convert((plan,typeof(object))); Func<object> fn = efn.Compile(); // Exception thrown here The variable plan is an Expression that represents the following execution plan:

Lucene.NET in medium trust

情到浓时终转凉″ 提交于 2019-12-08 09:39:15
问题 How do I make Lucene.NET 2.3.2 run in a medium trust environment? GoDaddy doesn't like it the way it is. 回答1: I just recently struggled with this, and wanted to update this with a solution I got to work. I pulled down the latest code and built it myself so I could make changes if needed. In the SupportClass.cs file, starting at line 481 there is some code that verifies a file buffer has been flushed using unmanaged code. if (OS.IsWindows) { if (!FlushFileBuffers(fileStream.Handle)) throw new

.NET 2.0 and MySql in medium trust mode

狂风中的少年 提交于 2019-12-08 07:39:33
问题 how do i access Mysql from an ASP.NET 2 site in medium trust mode? My ISP wont allow my site to run under full trust and i've tried many(if not all) mysql apis to connect to the db. All result in either SocketPermission or FileIOPermission errors. i have even tried overriding the trust setting in my web.config. Any ideas? 回答1: Ask them to put the MySQL assemblies in the GAC. This is a common issue with third-party databases and Medium Trust. I'll add that you're going to have to sweet talk

.NET 2.0 and MySql in medium trust mode

落花浮王杯 提交于 2019-12-08 03:45:27
how do i access Mysql from an ASP.NET 2 site in medium trust mode? My ISP wont allow my site to run under full trust and i've tried many(if not all) mysql apis to connect to the db. All result in either SocketPermission or FileIOPermission errors. i have even tried overriding the trust setting in my web.config. Any ideas? Ask them to put the MySQL assemblies in the GAC. This is a common issue with third-party databases and Medium Trust. I'll add that you're going to have to sweet talk them. They're going to need to trust the software they're going to be installing to not destroy their servers.

RDLC Medium Trust

坚强是说给别人听的谎言 提交于 2019-12-07 04:38:21
Does anyone know of a free (for a non-profit group) RDLC reporting tool that will work under medium trust in IIS 7? Our Data Dynamics Reports product is not free, but we did implement special support for working in the restrictive medium trust environments. I don't know if it is tested on IIS7 yet, but I presume the security policy is the same so it should work in any case. If it does not let us know and we will surely get it working as this is a scenario we explicitly wanted to make sure that we provide a great solution for. For more information see the following links: Brief information

Anonymous type in medium trust, works with Reflection not with Expressions

99封情书 提交于 2019-12-06 03:11:03
问题 I'm doing custom projections on Linq queries in Medium Trust and I get a MethodAccessException or TypeAccessException complaining about reflection and security rights. I've simplified the code to the following: var anon1 = new { Name = "Bill Gates" }; var ctor = anon1.GetType().GetConstructors().First(); // With native Reflection it works var anon2 = ctor.Invoke(new object[] { "Steve Ballmer" }); var expr = Expression.New(ctor, Expression.Constant("Scott Guthrie")); var lamb = Expression

Storing temporary user files in ASP.NET in medium trust

╄→гoц情女王★ 提交于 2019-12-06 02:12:02
问题 I have a scenario where users of my ASP.NET web application submit testimonials consisting of text info and images. The submit process has the following steps: First the user inputs the content and chooses a path to an image When he clicks preview, the info is once again shown so that he can confirm Once confirmed the info is persisted in the database The problem with this is that I don't want to store uploaded images in the DB before the user actually confirms. Instead I store them as

What Reflection Permission are allowed in Medium Trust?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 03:59:16
I want to ask that which methods/classes are allowed in Medium Trust. For example, whether these methods are allowed? GetProperties, GetMethods, Activator.CreateInstance, Assembly.Version, AssemblyName.Name Please tell me which methods are allowed. GetMethods and Activator.CreateInstance should be allowed IIRC, whilst AssemblyName and Assembly.Version aren't. I've used the first two methods in Medium-Trust environments and the latter two didn't work. Best way is just through trial-and-error really. Also might help by using Reflector when you do get stuck, to find out why stuff isn't allowed