This project is read-only.

Doesn't work in Medium Trust

Dec 3, 2010 at 5:22 PM

I'm trying to use the RazorEngine in a medium trust environment but it's throwing the following exception:

System.Security.SecurityException: Request failed. at RazorEngine.Compilation.RazorCompiler.CompileTemplate(String className, String template, Type modelType) at RazorEngine.Compilation.RazorCompiler.CreateTemplate(String template, Type modelType) at RazorEngine.Templating.TemplateService.GetTemplate(String template, Type modelType, String name) at RazorEngine.Templating.TemplateService.Parse[T](String template, T model, String name) at RazorEngine.Razor.Parse[T](String template, T model, String name)

Dec 6, 2010 at 1:15 AM

Will look into it :) strikes me as strange seeing as we are essentially just doing what the ASP.NET MVC Razor ViewEngine would be doing.

Dec 6, 2010 at 10:37 PM
Edited Dec 6, 2010 at 10:38 PM

It's fails on "var parameters = new CompilerParameters();"

This class contains a link demand and an inheritance demand at the class level that applies to all members. A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.

I have no clue how Razor can get around this and we can't.

Dec 13, 2010 at 8:31 PM


Just to let you know that this is still on the cards to be resolved, I just haven't had a lot of time as of late.  Hopefully we'll be able to address it in the coming weeks.

Dec 13, 2010 at 9:08 PM

That would be great, thanks for the update