SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried to migrate an external application into Sharepoint using Application Pages. The external code is included as Class libraries that's installed into GAC when deploying. My application generates XML and transforms it using Xslt into XHTML so I tought I could use most of my code and tweak the xslt / javascript into generating XHTML that works in Sharepoint.

But I get a problem loading the Xslt file and I have no clue why. In my desperation I've given Everyone Full Control on the ASP.Net temp files directory at C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files

The Errors I'm getting is:

System.IO.FileLoadException: Could not load file or assembly '0m_xtgin, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418) File name: '0m_xtgin, Version=, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.

The code where the problem occurs:

XslTransform Transformer = new XslTransform();
Transformer.Load(FolderName + FileName, new StyleResolver());

Any ideas what could be wrong or any ideas of what to do to work around this? What account could it be that's executing? Is it the Sharepoint App pool account?

share|improve this question

Is you assembly in the GAC or did you bin deploy it?

If it's a bin deploy, did you sign the assembly and configure the code access security?

share|improve this answer
All assemblies are in the GAC but the XslTransform seems to create dynamically generated assemblies from the xslt. I guess it's this generated assembly and some security permissions that creates the problem. The dynamically generated assembly is not in GAC (as far as I know). – Lilja Sep 2 '11 at 13:32
That sounds weird. I use the XslCompiledTransform a lot in SharePoint without this issue. Mine are also in the gac. Do you happen to be calling any extensions? Thanks. – Steve Lineberry Sep 2 '11 at 14:12
Maybe it's the deprecated XslTransform thats giving me the problem. I tried switching the XslTransform into XslCompiledTransform but it's not the same and I have no time rebuilding a the whole class. But maybe I have to :/ – Lilja Sep 4 '11 at 19:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.