Page 1 of 1

System.Security.SecurityException

Posted: Fri Jan 11, 2013 3:51 am
by eldiego
Hi, I am getting a System.Security.SecurityException with WURFL .Net API at Line 32

Code: Select all

Line 30:   var wurflPatchFile = HttpContext.Current.Server.MapPath(WurflPatchFilePath);
Line 31:   var configurer = new InMemoryConfigurer().MainFile(wurflDataFile).PatchFile(wurflPatchFile);
Line 32:   var manager = WURFLManagerBuilder.Build(configurer);
Here the stack trace:

Code: Select all

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +61
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +644
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +67
   WURFL.Resource.WURFLResources.WurflResource.GetStream() +29
   WURFL.Resource.WurflParser.ParsePatches(IEnumerable`1 patchesPath) +105
   WURFL.Resource.WurflParser.Parse(IWurflResource wurflResource, IWurflResource[] patchResources) +71
   WURFL.Devices.DeviceRepositoryBuilder.Build(String wurflFile, String[] patchFiles, MatchMode matchMode) +45
   WURFL.WURFLManagerBuilder.BuildFrom(Configuration configuration, ICache`2 cache) +81
   WURFL.WURFLManagerBuilder.Build(IWURFLConfigurer configurer) +49
My Web.Config has full trust level and the wurlf.zip file have full access.

Can anyone help me?

Re: System.Security.SecurityException

Posted: Sun Jan 13, 2013 11:35 pm
by kamermans
Hi,

We are looking into the issue, but in the meantime, can you verify that your application's user has access to the WURFL file you are using?

Re: System.Security.SecurityException

Posted: Mon Jan 14, 2013 12:01 pm
by kamermans
It seems the only explanation is that the trust level is too low, however, as of API 1.4.3 we support the Medium and Full trust levels, so I'm at a loss as to what the problem could be. Note that we released version 1.4.4 on Friday evening, so I would recommend using the new version anyway.

Download:
http://sourceforge.net/projects/wurfl/f ... API/1.4.4/

NuGet:
http://www.nuget.org/packages/WURFL_Official_API

Re: System.Security.SecurityException

Posted: Wed Jan 16, 2013 4:54 am
by eldiego
Thanks for the reply. Now I download the new version 1.4.4 and check again.

Re: System.Security.SecurityException

Posted: Fri Feb 08, 2013 9:18 am
by eldiego
Hi,
version 1.4.4 did not solve the issue. I'm using WURFL in a cluster evironment and the solution is to add wurfl.dll to the Windows GAC. This can be done using caspol.exe or simply drag&drop the dll into c:\windows\assembly folder.

Re: System.Security.SecurityException

Posted: Fri Feb 08, 2013 12:26 pm
by kamermans
Thanks for the feedback, we will find an appropriate place in the documentation to add this tip.