Question

I'm having difficulty with my project and deploying it on my web hosting provider. I'm on a shared hosting environment with "Host Level" trust.

I have used LINQ in my project but now they've just told me that Reflection is disabled on their shared services. I believe that reflection is required to be able to use variables within the queries.

When I run the project in the host level trust environment, I get an Exception:

MethodAccessException:
System.Runtime.CompilerServices.StrongBox`1..ctor(System.__Canon)

Does anyone have any experience in this area? Any suggestions would be greatly appreciated

It's failing on this code:

public override bool ValidateUser(string username, string password) {

   using (var dc = new mcDataContext()) {
      var query = (from c in dc.CF_Clients
                   where c.Client_ID == username
                   select new
                   {
                      c.Client_Password
                   }).FirstOrDefault();

  }
}
Was it helpful?

Solution

OTHER TIPS

Try replacing

from c in dc.CF_Clients

with

from Client c in dc.CF_Clients

Or whatever your type is (in this case I assumed it is a Client object). If you implicitly cast the objects from the collection, then it shouldn't have to use reflection to access the properties in the query.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top