Caspol: .Net 2.0 app failing on win 2008 when hosted on UNC path

Helping one of mate in our team with issue where application was failing with System.Security when contents were pointing to UNC path.We were getting following error in the browse:

Parser Error Message: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (\\abc02\myapp\web.config line 84)

This application was hosted on windows 2008 - IIS 7 server.

First thing came into my mind is to see whether we've set FullTrust according to KB 320268.
We were using  caspol.exe to set permissions as we were missing Microsoft .NET Framework 2.0 Configuration tool (it gets installed with SDK)  🙂

Running following command in CMD

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on

Application in question was still failing with same error. As a general troublehsooting step thought to try with new share folder and with simple test.aspx in it. Then added Fulltrust permission for that path and it worked. Now that made me to point finger toward the application compatibility.

Next steps was looking into procmon logs and it seem like .Net was trying to read config file from framework64 folder.That raise eyebrow and apparently application was hosted on win2008 x64 server and was running in native mode.

It turns out that .NET stores its security configuration separately for x64 and x32.  Thatz it. we have to run the command again from the Framework64 instead of Framework folder

C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727> caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on

Till then Blushing

Comments (6)

  1. Mike says:

    Thanks for posting this! We were facing this exact problem.

  2. jaskis says:

    Hi Mike,

    I’m glad it helpped you.



  3. 2ooom says:

    Helped to sole my problem, thank you)

  4. MIchael says:


    Thanks for this article, we had the same issue and after a couple of hours I found this site and 64bit, suddenly the light bulb came on and all was well with our IIS  🙂


  5. Jonathan says:

    Thanks again, this helped me solve the same problem.

  6. Jeff says:

    Thank you for this!  Saved my bacon during my migrations this weekend.

Skip to main content