0
votes

I'm using ASP.NET MVC 3.

It works fine on my machine, but I'm getting this error on the server.

Here is the Stack Trace:

[SecurityException: Request failed.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241 System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.SecurityUtils.SecureCreateInstance(Type type, Object[] args, Boolean allowNonPublic) +93
System.ComponentModel.ReflectTypeDescriptionProvider.CreateInstance(Type objectType, Type callingType) +92
System.ComponentModel.ReflectedTypeData.GetConverter(Object instance) +346
System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter() +63 System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetConverter() +97 System.ComponentModel.TypeDescriptor.GetConverter(Type type) +23
System.Web.Mvc.ModelMetadata.get_IsComplexType() +13 System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +357
System.Web.Mvc.DefaultModelBinder.GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) +17
System.Web.Mvc.DefaultModelBinder.BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor) +367
System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) +94
System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +55
System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +1228
System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +385
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +303
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +105
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329 System.Web.Mvc.Controller.ExecuteCore() +115 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c_DisplayClassb.b_5() +37 System.Web.Mvc.Async.<>c_DisplayClass1.b_0() +21 System.Web.Mvc.Async.<>c_DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult1.End() +55 System.Web.Mvc.<>c_DisplayClasse.b_d() +31 System.Web.Mvc.SecurityUtil.b_0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

Here is the method signature:

[HttpPost]
public ActionResult Editar(Pessoa model, Movimentacao[] movimentacoes, FormCollection form){...}

Here is the data that I'm posting to the server:

IdPessoa=63&input-tab=7&Nome=Andrea+S.+Gomes&CPF=&Identidade=&DataNascimento=&Sexo=f&EstadoCivil.IdEstadoCivil=2&Profissao.IdProfissao=-1&ProfissaoDescricao=&DataConversao=&BatismoData=&BatismoIgreja=&BatismoPastor=&Endereco=&Complemento=&Estado.IdEstado=1&Cidade.IdCidade=1&Bairro.IdBairro=7&CEP=&Referencia=&Telefone1=&Telefone2=&Email=&Messenger=&Twitter=&PessoaVinculo.IdPessoaVinculo=2&Congregacao.IdCongregacao=6&Ativo=true&Ativo=false&Discipulador.IdPessoa-input=&Discipulador.IdPessoa=&UltimaVisita=&Conectado=false&PequenoGrupo.IdPequenoGrupo=-1&Observacao=&Competencia3=false&Competencia1=false&Competencia2=false&movimentacoes%5B0%5D.IdMovimentacao=0&movimentacoes%5B0%5D.Data=&movimentacoes%5B0%5D.MovimentacaoTipo.IdMovimentacaoTipo=-1&submitButton=

1

1 Answers

1
votes

It might not work because on the server you are trying to run this site the security level could be set to low which would restrict reflection code to run. Such things might happen on shared hosts.