Using WPF class in a web application, problem with hosting permission
I'm developing a DLL that uses WPF classes to make image manipulation. It works fine in my local environment, but when I try to use it in an hosted web site I retrieve this error:
Request for the permission of type 'System.Security.Permissions.MediaPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' failed.
exactly when I try to call the EndInit() of a BitmapImage object:
BitmapImage originalImage = new BitmapImage();
originalImage.BeginInit();
originalImage.C开发者_运维问答acheOption = BitmapCacheOption.OnLoad;
originalImage.UriSource = new Uri(physical_imagepath);
originalImage.EndInit();
Any suggestion?
Ask your host to change the permissions.
If they refuse, switch to a better webhost.
精彩评论