This project is read-only.

Security Exception

Topics: Developer Forum
Jul 4, 2009 at 12:38 AM

I downloaded the beta release of MWPSK 1.3.0.  My hosting provider is  After I uploaded my MWPSK 1.3.0 test project to and tried to access it from my browser, I get the error shown below.

Can somebody please help me.  Is there anything I can do with my project to get around this problem?  Is this problem because of my hosting provider

Just so you know, I have already tried using the "admin" tools on and set the project folder on with the "Write and Modify" attributes (recursively).  I have also set the path to the project as an "Application", but I still cannot get around this error.

I don't know what else to try in order to make my MWPSK 1.3.0 web site work with my provider.  Any suggestions?

Here is the error ...


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 for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

Line 15: 		
Line 16: 		if (!Directory.Exists(galleryPath))
Line 17: 			Directory.CreateDirectory(galleryPath);
Line 18: 
Line 19: 		ftbEditor.ImageGalleryUrl = ResolveUrl(string.Format("~/ftb.imagegallery.aspx?rif={0}&cif={0}", galleryPath));
Jul 7, 2009 at 5:15 AM
Edited Jul 7, 2009 at 5:17 AM

I have the same problem, and i think the issue is:

1- We are publishing on a hosting which is medium trusted

2- ..and this starter kit use "App_Data" application folder, that means: is used to prevent access to data from web request... so in order to access files server.mappath is needed and that means the application is trying to access to "D:\yourhostingspace\App_Data" which is not allowed by medium trusted level (even when is in the same hierarchy of our solution and the target of web request) because we are "leaving the scope of our app"., i don't know what to do now.


Any suggestion?.

Jul 8, 2009 at 10:56 AM

Hi there

I guess it's not an effect of medium trust, as all the other files for the sections and pages etc. are also created inside App_Data. Accessing the Files inside App_Data by Server.MapPath is allowed, while direct acces via HTTP (from the browser) to files inside App_Data isn't.

Have you tried to create pages/sections on the exact same server? Does this work?

Jul 8, 2009 at 6:41 PM
Edited Jul 8, 2009 at 6:46 PM

Hello there;

Thanks for the comment. And yes, you are right... i installed a blank copy of MWPSK on server and i could add page sections and the menu was edited and works fine until I added a control... i added HTML control to Homepage and the system fails and the error appear again and nothing more was able to do.


What you think..



Best regards

Jul 9, 2009 at 1:16 PM


The problem has been tracked down and solved by one of our users: (Thanks TBPrince btw ;-))

If you follow TBPrince's instructions you can fix this by yourself or wait for v1.3.0 final to come out where it will of course be fixed.

Happy content editing,

Jul 10, 2009 at 5:57 AM
Edited Jul 10, 2009 at 6:02 AM

Hi there!

Thanks a lot, this fix the problem, hope this help you "vancebradford". But now i have another problem with this change. The htmleditor image gallery is setted in line 19:

ftbEditor.ImageGalleryUrl = ResolveUrl(string.Format("~/ftb.imagegallery.aspx?rif={0}&cif={0}", galleryPath));

"galleryPath is used and the target is bad to load the gallery control if you want to add images to your html. I make this changes..



string galleryPath = Server.MapPath("~/App_Data/UserImages/Image");
string galleryReqPath = ResolveUrl("~/App_Data/UserImages/Image");
if (!Directory.Exists(galleryPath))
ftbEditor.ImageGalleryUrl = ResolveUrl(string.Format("~/ftb.imagegallery.aspx?rif={0}&cif={0}", galleryReqPath));
ftbEditor.ImageGalleryPath = galleryReqPath;

Now it's working fine...


Best regards.






Jul 11, 2009 at 2:19 AM

I want to thank you very much, MRAatFC, alexsegovia, and especially TBPrince!

This solved my problem and MWPSK 1.3.0 Beta is now working for me on my service provider,

Thanks again!!!

Vance Bradford