+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Libraries and Images module in medium trust

Libraries and Images module in medium trust

20 posts, 0 answered
  1. Andrew
    Andrew avatar
    47 posts
    Registered:
    22 May 2009
    17 Jun 2009
    Link to this post
    Hi

    I'm getting the following exception on a medium trust environment when trying to upload to the Images & Documents library. I thought this issue had been resolved in SP1? I'm using 3.6  SP2.

    Regards
    Andrew

    Security Exception

    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

    Exception Details: System.Security.SecurityException: Request failed.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [SecurityException: Request failed.]
       System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +150
       System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) +100
       System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException) +284
       System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh) +69
       System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh) +150
       System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +30
       System.Threading.CompressedStack.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet) +40
       System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext) +123
       System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant) +54
    
  2. Stoyanka Assenova
    Stoyanka Assenova avatar
    113 posts
    Registered:
    01 Dec 2016
    18 Jun 2009
    Link to this post
    Hi Andrew,

    You should comment the RadUpload Module in the httpModules section in the web.config file when you run the application in medium trust.
    <httpModules> 
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
          <add name="Cms" type="Telerik.Cms.Web.CmsHttpModule, Telerik.Cms" /> 
          <!--<add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" />--> 
    </httpModules> 

    Hope this helps.

    Regards,
    Stoyanka Assenova
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Andrew
    Andrew avatar
    47 posts
    Registered:
    22 May 2009
    18 Jun 2009
    Link to this post
    Thanks for the quick reply. I had seen this solution mentioned in another thread. Will I see any differences or will it cause any problems by removing this module?

    Thanks again
    Andrew
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    18 Jun 2009
    Link to this post
    Hi Andrew,

    The only difference is that the progress bar will not visible. There are no functional differences though.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. Jason
    Jason avatar
    23 posts
    Registered:
    17 Jun 2009
    23 Apr 2010
    Link to this post
    Hi,

    I am receiving the same error as discussed in this thread however i am unable to find a way around it.  The error comes up when i try to upload images to the site through a created images library.  I'm not sure what security level is in place but i tried commenting out the RadEditor line as discussed in a previous post.  Any further suggestions on how i can fix this error?

    Cheers
    Jason
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Apr 2010
    Link to this post
    Hi Jason,

    It is possible that your host policy does not meet the default security policy for medium trust and you get the error. The error System.Security.SecurityException: Request failed. is caused because the trust level of the application does not allow to perform a given operation.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. Jason
    Jason avatar
    23 posts
    Registered:
    17 Jun 2009
    25 Apr 2010
    Link to this post
    Thanks for your reply.  I checked with the server admin and apparently the server does have medium trust. 

    Could there be something in the web.config that prevents the uploading of images?

    Cheers
    Jason
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Apr 2010
    Link to this post
    Hi Jason,

    Please take a look at these posts/articles


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. Dennis
    Dennis avatar
    16 posts
    Registered:
    10 Aug 2012
    13 May 2010
    Link to this post
    Hi, I am working on the same site as Jason and we still can't get any images to upload to the Images&Documents module. I comented out the add name="RadUploadModule" and there is no server error anymore. Instead, there is a Sitefinity error:

    The following files:

    • ImpactIT.jpg

    could not be uploaded . There was a server error.


    I checked the generic content upload and I can finally uplad an image to the ~/images directory but not to the Image library (even after I created a new library)

    I made sure that the settings for medium trust we set as the link to the posts above showed and then looked around teh web.config to see iof I would find anything else that was not right. I found <remove name="LibraryModule"/> and <add name="LibraryModule"... were commented out for some reason but even when I removed the coment markup <!-- and published the web.config I still got the Sitefinity error uploading to the library.

    What elase could be causing this issue?


    Thanks in advance!
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 May 2010
    Link to this post
    Hello Dennis,

    "There was a server error." - there is a problem with IIS or SQL server. You could check whether due to some limits the IIS recycles or timeout. Check the same for SQL server. If you use Nolics provider it is possible that the blob data could not be handled by your SQL server. Since 3.7 SP3 we created a new provider - Files which works with chinks. More information at

    How to enable the Files provider for Images and Documents module in Sitefinity 3.7 SP3
    Handling Large Files in Sitefinity (a.k.a Streaming)

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. Dennis
    Dennis avatar
    16 posts
    Registered:
    10 Aug 2012
    13 May 2010
    Link to this post
    Hi, Thanks for your reply, no it is not a server or database issue. It is all managed via HSphere so I have no direct control over it. It seems like it is just a configuration issue. I am not sure what version it is but the CMS help looks like it is actually 3.2 so I am checking and trying to find out how to upgrade it to 3.7 SP3. It is more difficult now as there is no direct link availabel to download the community 3.7SP3 so we might be stuck. We have no had this persistant error on any other SF site on the same server and the disabling of RadUploadModule allowed some ability to upload files and therefore, as mentined it seems to be a configuration error (web.config?)
  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    14 May 2010
    Link to this post
    Hello Dennis,

    Unfortunately the information you have provided is not enough to narrow down the issue. You could try to set the project on a local server and see whether the  same problem will appear there. Then you could check the log files and see if there is any error.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  13. Dennis
    Dennis avatar
    16 posts
    Registered:
    10 Aug 2012
    20 May 2010
    Link to this post
    Hi, I have spent the last few days tryng to get the log files from the hosts and they will send the LDF file soon. I tryied uyploading am image again to a newly created test page so I had the latest transaction in the LDF file and to my supprise I got a full servcer error from within the image upload window of the image control. I tried the same thing from the generic content and got the same error from the image upload window. I have included the error at teh bottom of this post. Perhaps this can help as it mentions "Database needs to be upgraded" and lists verious Teleric controls.

    I found out that the SF version of this site is 3.7 (as the title of the CMS pages is "Administration - Sitefinity 3.7").

    I also tested again the ability to upload images to the ~/image directory and that worked fine. So a workaround might be to remove the option of using teh Images & Documents module. How do I do that from the web.config? The client has admin access so I can't just disable it from the CMS side, I need to disable it from code.

    The database is MSSQL 2005 and is being used for other Sitefinity sites however, there was an error when the database was beign uploaded. It exceeded the database size and stopped uploaded. I increased the size and adjusted the % of log file space to 10% (I often decrease the log file percentage as a Sitefinity upload using a lot of log file) . This is the only problem we have had with the database and after adjustng the %, the database uploaded sucessfully and all the other functions of the CMS work fine.

    I hope this extra information helps.

    Thanks

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Database needs to be upgraded
    Description: An unhandled exception occurred during the execution of the current web request.

    Please review the stack trace for more information about the error and where it originated in

    the code.

    Exception Details: System.InvalidOperationException: Database needs to be upgraded

    Source Error:

    An unhandled exception was generated during the execution of the current web request.

    Information regarding the origin and location of the exception can be identified using the

    exception stack trace below. 

    Stack Trace:

    [InvalidOperationException: Database needs to be upgraded]
       Telerik.Versioning.Data.DefaultProvider.Initialize(String name, NameValueCollection config)

    +1266
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings, Type

    providerType) +673
       Telerik.ManagerBase`1.InstantiateProvider(ProviderSettings providerSettings) +91
       Telerik.ManagerBase`1.SetProvider(String providerName) +199
       Telerik.ManagerBase`1..ctor(String providerName) +89
       Telerik.Versioning.VersionManager..ctor(String providerName) +4
       Telerik.Cms.Engine.ContentProviderBase.get_Version() +47
       Telerik.Cms.Engine.ContentManager.CreateVersion(IContent cntItem, CultureInfo cult) +433
       Telerik.Cms.Engine.ContentManager.CreateContent(String mimeType, Guid id) +218
       Telerik.Cms.Engine.ContentManager.CreateContent(String mimeType) +38
       Telerik.Libraries.LibraryManager.UploadFile(Byte[] buffer, String fileName, String

    fileExtension, String mimeType, Int64 streamLength, ILibrary library, Boolean overwrite) +350
       Telerik.Libraries.LibraryManager.UploadFile(Byte[] buffer, String fileName, String

    fileExtension, String mimeType, Int64 streamLength, ILibrary library) +31
       Telerik.Libraries.WebControls.ImageEditorDialog.UploadButton_Command(Object sender,

    CommandEventArgs e) +1973
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +108
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent

    (String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String

    eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean

    includeStagesAfterAsyncPoint) +1565

     

    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET

    Version:2.0.50727.3053


  14. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 May 2010
    Link to this post
    Hello Dennis,

    Compare the versions of your local and sever database.  Make sure that you do not have two websites with a different version connected to the same database which is not supported and this cause upgrade the the database. The stack where the error is thrown initialized the versioning data provider which checks [sf_VersVariables] table and compare the value of VrsSchemaVersion with the version of your project. If there are different this requires database upgrade which is automatically performed. When you have two projects with different versions to the same database each of them causes upgrade and downgrade of the database.

    You could change the value of VrsSchemaVersion manually to something like "1" and then request the website. The VrsSchemaVersion will be changed and the database upgraded internally.

    Also the exact error "Database needs to be upgraded" is thrown when the project is running in medium trust, since the upgrade requires Full Trust  and PermissionState.Unrestricted. So the website is trying to upgrade the database and fix the issue, but it runs in Medium Trust( or PermissionState.Unrestricted is false).

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  15. Dennis
    Dennis avatar
    16 posts
    Registered:
    10 Aug 2012
    27 May 2010
    Link to this post
    Hi Ivan,

    Thanks for that added info. You are most helpful. I have found out that the database where the site was created initially locally was actually a SQL2008 but the online database is SQL2005. The developer has always done this in the past past and when he has uploaded the database to the SQL2005 server site to a medium trust Windows 2003 shared server, It has worked without changing anything. Perhaps Sitefinity usually automatically converted the site to be compatible with the 2005 db?

    Anyway, I can't change the trust level of the shared server and we don't have SQL2008 hosting so what do I need to change to convert the Sitefinity site to use the SQL2005 server without throwing an error?

    I find it quite strange that Sitefinity allows the updating and storing of most site content in the SQL2005 database but has an issue with the library. Perhaps the library by default uses coding only capatible with SQL2008?

    Thanks
  16. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 May 2010
    Link to this post
    Hi Dennis,

    You cannot restore backup made with SQL Server 2008 to SQL Server 2005. You may script all tables and import them to the SQL 2005 database. Sitefinity does not convert the database driver - we use common driver for SQL 2005 and SQL 2008.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  17. Gregory
    Gregory avatar
    2 posts
    Registered:
    08 Jun 2010
    08 Jun 2010
    Link to this post
    We also are having this issue with a module we created. The site is running fine otherwise in medium security. Is there anything we can or need to put in the web.config file to allow this Partner module access in a medium security environment? On the front end views it works great, on the back-end it throws the following error when trying to access that part of the administration panel. Please help!

    -----------------------------------------

    Security Exception

    Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. 

    Exception Details: System.Security.SecurityException: Request failed.

    Source Error: 

    Line 12:     protected override void CreateViews()
    Line 13:     {
    Line 14:         AddView("PartnersListView", "~/Custom/Modules/Partners/Backend/Views/PartnersListView.ascx", "View Partners", "A list of all partners", "all", null);
    Line 15:         AddView("PartnerEditView", "~/Custom/Modules/Partners/Backend/Views/PartnerEditView.ascx", "Edit a Partner", "Edit a Partner", "all", null);
    Line 16:         AddView("PartnerNewView", "~/Custom/Modules/Partners/Backend/Views/PartnerNewView.ascx", "Create a New Partner", "Create a new partner", "all", null);

    Source File: \\fs2-n01\stor1wc2dfw1\469823\469828\www.xxxxxx.com\web\content\App_Code\Partners\PartnersView.cs    Line: 14 

    Stack Trace: 

    [SecurityException: Request failed.]
       Telerik.Cms.Web.UI.ViewModeUserControl`1.AddView(String viewName, String virtualPath, String title, String description, String viewCommandCssClass, ResourceManager resources) +0
       PartnersView.CreateViews() in \\fs2-n01\stor1wc2dfw1\469823\469828\www.xxxxxx.com\web\content\App_Code\Partners\PartnersView.cs:14
       Telerik.Cms.Web.UI.ViewModeUserControl`1.get_Views() +161
       Telerik.Cms.Web.UI.ViewModeUserControl`1.InitializeControls() +56
       Telerik.Cms.Web.UI.ViewModeUserControl`1.CreateChildControls() +32
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +44
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Control.PreRenderRecursiveInternal() +171
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
       System.Web.UI.Page.ProcessRequest() +80
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49
       ASP.sitefinity_admin_modules_aspx.ProcessRequest(HttpContext context) in App_Web_pnegxurb.4.cs:0
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

  18. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    08 Jun 2010
    Link to this post
    Hi Gregory,

    The error is caused by server side settings which are not controlled by Sitefinity. Most probably the Medium Trust configuration is not the default one for this level or there are some additional restrictions made to the security policy.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  19. Gregory
    Gregory avatar
    2 posts
    Registered:
    08 Jun 2010
    08 Jun 2010
    Link to this post
    Thank you for the quick response. What setting would cause this? Why would all other modules work, but not the one we created? Is there any pointer you can give so we can attempt to figure this out. I see a lot of entries in the web.config file for sectionGroups, modules, etc. which we do not have an entry for and am wondering if that needs to be explicitly stated somewhere for the application to run our module in medium trust. Any thoughts? It seems like a lot of people have come across this and any help/guidance would be greatly appreciated. Thanks!
  20. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Jun 2010
    Link to this post
    Hi Gregory,

    Here is a link to MSDN which described the Trust levels and permissions access . Check whether there are some additional restrictions that alter the default configuration. Try to compile the module into dll instead of loading it through App_Code folder.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
20 posts, 0 answered