Image gallery error

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
2/26/2009 4:31:17 PM
Gravatar
Total Posts 16

Image gallery error

I am getting the following error when trying to view a page that has the image gallery option on.

2009-02-26 14:46:19,823 INFO mojoPortal.Web.Global - Application Started.
2009-02-26 14:46:19,839 ERROR mojoPortal.Web.Global - Application_Start Could not register VirtualPathProvider, must be running in Medium trust or lower
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
at mojoPortal.Web.Global.RegisterVirtualPathProvider()
at mojoPortal.Web.Global.Application_Start(Object sender, EventArgs e)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Web.AspNetHostingPermission
The Zone of the assembly that failed was:
MyComputer

2/26/2009 4:34:16 PM
Gravatar
Total Posts 18439

Re: Image gallery error

Hi,

You are running in Medium Trust, did you follow the steps in this page?

http://www.mojoportal.com/mediumtrust.aspx

Hope it helps,

Joe

2/27/2009 12:16:09 PM
Gravatar
Total Posts 16

Re: Image gallery error

You did it!

I did previously look at the article and ignored a very important step. Allow write access to app_data\NeatUpload_Temp.

Thank you very much :). I am not a huge fan of godaddy but I use them. Feel free to chop the rest of the post.

For other godaddy hosting users I would like to "contribute" with my messy installation notes:

Have a Windows Deluxe hosting account

Copy your wwwroot mojoportal files to any folder it does not have to be root, a folder named mojoportal would
be nice :)

Upload using filezilla so you would know if any files had problems, its 8000 files strong and the built in
FTP client for Dreamweaver will take forever and you might never know what was uploaded or not.

Log on to godaddy.com and find your HOSTING CONTROL CENTER, click on YOUR FILES, on the right hand side put a
checkmark on your Data folder and select the permissions icon on the top. Uncheck Inherit and check write.
Very Important - put a check on Reset all children to inherit. then clik ok. Do the same to the folder
located the NeatUpload folder located on app_data\NeatUpload_Temp.

Setup a MS SQL database on godaddy sorry I dont describe how.
Look for MSSQLConnectionString on the Web.config file and change it with your information it would look close
to this:
<add key="MSSQLConnectionString"
value="server=yourname.db.3888244.hostedresource.com;UID=username;PWD=password;database=username" />

Next step is medium trust:
1.Rename Web.config file to Web.fulltrust.config
2.Rename Web.mediumtrust.config to Web.config
3.Delete DotNetOpenId.dll from the /bin folder
4.Make sure and visit your /Setup/Default.aspx page, it should tell you a setting you need to add to
Web.config for the search engine to get around a medium trust issue.
http://www.mojoportal.com/mediumtrust.aspx

After setting your connection string and uploading the edited file, visit the web page at
http://yoursiterootordomainname/Setup/Default.aspx and mojoportal setup will proceed with installing the
tables and other database obejcts into your database.

After the installation you will get a message with something like this
In order for the Search Engine to work in Medium trust, you need to add this in Web.config in the AppSettings
section:

<add key="Lucene.Net.lockdir" value="D:\Hosting\3888244\html\birmiami\Data\Sites\1\index" />
do it.

Go to your home page.

2/27/2009 4:46:07 PM
Gravatar
Total Posts 16

Now I have a Simple folder gallery error

They all look security related. I am sure there are more folders that need write access. Here is my error

2009-02-26 14:46:19,823 INFO mojoPortal.Web.Global - Application Started.
2009-02-26 14:46:19,839 ERROR mojoPortal.Web.Global - Application_Start Could not register VirtualPathProvider, must be running in Medium trust or lower
System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
at System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
at mojoPortal.Web.Global.RegisterVirtualPathProvider()
at mojoPortal.Web.Global.Application_Start(Object sender, EventArgs e)
The action that failed was:
InheritanceDemand
The type of the first permission that failed was:
System.Web.AspNetHostingPermission
The Zone of the assembly that failed was:
MyComputer
2009-02-26 14:46:21,274 INFO mojoPortal.Web.WebTaskManager - deserialized WebTaskManager task
2009-02-26 14:46:21,274 INFO mojoPortal.Web.WebTaskManager - Queued WebTaskManager on a new thread
2009-02-26 14:46:21,321 ERROR mojoPortal.Web.Global - 66.176.137.121-en-US - /birmiami
System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app)
at mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
2009-02-26 14:46:21,570 INFO mojoPortal.Business.WebHelpers.IndexWriterTask - deserialized IndexWriterTask task
2009-02-26 14:46:21,570 INFO mojoPortal.Business.WebHelpers.IndexWriterTask - Queued IndexWriterTask on a new thread
2009-02-26 14:46:29,043 ERROR mojoPortal.Web.UI.Pages.SiteHome - 66.176.137.121 - Error setting master page. Will try settingto default skin
System.Web.HttpException: The file '/birmiami/Data/Sites/1/skins/valzero-birmiami/layout.Master' does not exist.
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
at System.Web.UI.Page.get_Master()
at mojoPortal.Web.UI.Pages.SiteHome.SetupMasterPage()
at mojoPortal.Web.UI.Pages.SiteHome.OnPreInit(EventArgs e)

2/28/2009 1:09:28 PM
Gravatar
Total Posts 18439

Re: Image gallery error

None of these errors appear related to the folder gallery. The first error, you will see it logged every time the application_start event fires because it can't use the VirtualPathProvider in medium trust, its an expected error and is handled and logged. The other errors are not related.

I'm not 100% sure if the Folder Gallery can work in Medium Trust but my recollection is that it did work for me. I would have to test it again to know for sure, if I get a chance in the next few days I'll try it.

Best,

Joe

3/1/2009 9:58:13 AM
Gravatar
Total Posts 18439

Re: Image gallery error

I just tested folder gallery here and it works fine for me in medium trust.

The /Data folder must be completely writable so new folders and files can be added by the code.

Really what you should do is organize pictures into a folder(s) on your local machine, then ftp the folder(s) into this folder:
/Data/Sites/[SiteID]/FolderGalleries/

It will create thumbnails in /Data/systemfiles/FolderGalleryCache

The thumbnails will be created automatically the first time you visit the page with the folder gallery on it.

Hope it helps,

Je

3/3/2009 11:06:07 AM
Gravatar
Total Posts 16

Re: Image gallery error

I can provide you with full ftp access if you like. I am unable to deploy the site on schedule anyways. Also I can help document the installation and I would like to send a list of petty fragments like today's date, random fact, and others I put toguether that I am sure users would appreciate.

Here is the link of the site http://www.brickellinvestmentrealty.com/birmiami/ that shows an error but if you visit like this http://www.brickellinvestmentrealty.com/birmiami/default.aspx it does not. I am sorry if I am not using the forum properly.

3/5/2009 6:12:45 AM
Gravatar
Total Posts 18439

Re: Image gallery error

Hi,

I don't see any different between the 2 urls when I view them.

If you have any fragments you would like to share you can send me a .zip and description of each fragment and I will make them available on the community downloads page.

If you are still experiencing any errors, one thing that could be a factor is that you have a different ASP.NET app running in the root of the site, sometimes there can be conflicts between Web.config file in mojoPortal and the one in the root folder.

Best,

Joe

3/5/2009 9:29:56 AM
Gravatar
Total Posts 16

Re: Image gallery error

The fragments are a brilliant approach. Thanks to that I can use includes. Your whole application is amazing. Where do I send my fragments to?

3/5/2009 11:42:03 AM
Gravatar
Total Posts 18439

Re: Image gallery error

oops forgot, you can send to me at joe dot audette at g mail dotcom

Best,

Joe 

3/16/2009 7:51:11 PM
Gravatar
Total Posts 5

Re: Image gallery error

Hi Joe,

fist off all thanks for the cool portal ....

I'm also try to install a site on godaddy to get the mojo Portal running, I'm thinking I'm at the same stage like Valzero, did the same same steps, exept the Lucene.Net.lockdir entry, which I din't change so far. However beside the VirtualPathProvider-exception, I have also the following enty. the upload is working, also the other gallery (writing into the GalleryImages is working), the error is in the case that some images are in FolderGalleries and I thing it while they want to create the thumbnails (in the GalleryImages where created succesfully) ... do you have any ideas.

@Valzero: thanks for the detailed descriptions of the steps, which I have done independently. Did you get the FolderGalleries running in the meantime? You portal look really good.

BR
Volker
Here my exeption:

2009-03-16 16:04:11,624 ERROR mojoPortal.Web.mojoBasePage - 77.56.59.125-de-CH - /mojo/fotos-simple.aspx
System.Reflection.TargetInvocationException: Property accessor 'Link' on object 'mojoPortal.Web.Controls.FolderGallery.AlbumFolderInfo' threw the following exception:'The type initializer for 'mojoPortal.Web.Controls.FolderGallery.ImageHelper' threw an exception.' ---> System.TypeInitializationException: The type initializer for 'mojoPortal.Web.Controls.FolderGallery.ImageHelper' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
at System.IO.Directory.CreateDirectory(String path)
at mojoPortal.Web.Controls.FolderGallery.ImageHelper..cctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
MyComputer
--- End of inner exception stack trace ---
at mojoPortal.Web.Controls.FolderGallery.ImageHelper.JScriptEncode(String unencoded)
at mojoPortal.Web.Controls.FolderGallery.AlbumPageInfo.get_Link()
--- End of inner exception stack trace ---
at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
at System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
at System.Web.UI.DataBinder.Eval(Object container, String expression)
at System.Web.UI.TemplateControl.Eval(String expression)
at ASP.foldergallery_foldergallerymodule_ascx.__DataBinding__control9(Object sender, EventArgs e)
at System.Web.UI.Control.OnDataBinding(EventArgs e)
.....
at mojoPortal.Web.mojoBasePage.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2009-03-16 16:04:11,827 ERROR mojoPortal.Web.Global - 77.56.59.125-de-CH - /mojo/fotos-simple.aspx
System.TypeInitializationException: The type initializer for 'mojoPortal.Web.Controls.FolderGallery.ImageHelper' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
at System.IO.Directory.CreateDirectory(String path)
at mojoPortal.Web.Controls.FolderGallery.ImageHelper..cctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
MyComputer
--- End of inner exception stack trace ---
at mojoPortal.Web.Controls.FolderGallery.ImageHelper.JScriptEncode(String unencoded)
at mojoPortal.Web.Controls.FolderGallery.AlbumPageInfo.get_Link()
 

3/17/2009 5:43:18 AM
Gravatar
Total Posts 16

Re: Image gallery error

Yes the image gallery is working on godaddy. I made a folder using an ftp client and uploaded the pictures there. Then I started uploading pictures using mojoportal 1 by 1. You are not able to upload multiple pictures. I am very happy to see that someone was able to get mojoportal running with my messy notes!!!! They are nothing but joe's responses in a specific order.

You have to use image gallery the simple image gallery does not work probably something about running on medium trust.

I hope this helps with your image gallery error. You can see the godaddy image gallery working on godaddy on this link http://www.brickellinvestmentrealty.com/birmiami/bristol-condo.aspx

P.S. I am not able to help debug your logged error message because I am not a designer a programmer or anything like that.

3/17/2009 4:22:12 PM
Gravatar
Total Posts 5

Re: Image gallery error

Hi Valzero,

ohh, I think I have to dissapoint you, I didn't get the portal running with you notes. I did it without your description, however I saw afterwords by searching here in the forums, that this describe exacly what I have done so far ;-). Its a good start to get task list for install it on godaddy. I have also the image gallery running and I can also upload the images there, but this doesn't support sub folders. That the reason, why I want to get the other running. The folder image gallery works a long it has no uploaded images. If I upload the images (the upload is working) or copy images into the portal with FTP, I'm getting the error. The errors says to me that the it get an error (FileIOPermission) while creating a folder (I guess it is while it created the thumbnails). But I cannot figure out why or where this folder should be created, the /Data is read/write (beside app_data), and also the other image gallery is creating successfully images for the thumbnails (and directories for it). I have the feeling it is not pointing inside the /Data directory perhaps some temp or something like that .... I have no other ideas.

BR
Volker

3/17/2009 9:12:09 PM
Gravatar
Total Posts 16

Re: Image gallery error

I wonder what that page is supposed to look like? Is it a better gallery? If so is worth having. If not you can just have links on the left pointing at different pages within the same page and all of them running a different image gallery. Search for the post for ALT 1 and ALT 2 fields they cover the whole with of the site and look fantastic for header/footer pieces. The 3 column format gets boring fast. Joe wrote a post about it that plays it down a bit, but I think is great feature.

P.S. thanks for pissing on my good deed for the day. Now I have to go do some voluntary work or I wont be able to sleep .

You can barely tell that we do not speak english in daily basis.

3/18/2009 6:49:05 AM
Gravatar
Total Posts 18439

Re: Image gallery error

Hi Guys,

When I test on my local machine under Medium Trust, the folder gallery works just fine. It creates its thumbnails and medium size images in the folder /Data/systemfiles/FolderGalleryCache

So as long as it can create files and folders beneath /Data it should not be a problem with write permission.

I wonder, when you upload files via ftp, do the files have different permissions on them? I would make sure they are readable by the web process identity user.

Hope it helps,

Joe

3/18/2009 12:57:34 PM
Gravatar
Total Posts 5

Re: Image gallery error

Hi Joe,

I checked it, but I cannot find this directory, neither systemfiles nor FolderGalleryCache below. I guess this will be created normally by the process. About the Data directory, I doble checked this and made again "Reset all children to inherit", this dosn't help. I navigated also to the directoy where I uploaded the files, it is read/write (With the goddy tool you cannot see the permissions on file level. I don't think that this is the problem, normally this should be inherit from the folder). Anyway, I uploaded all files with the upload function from web portal to be sure, so I can be sure that the file created by the ASPNET process, this one should be readable. I have also created the directory /Data/systemfiles/FolderGalleryCache in the application root (in my case 'mojo') manually. Also checked here the file permissons that it is read write. Nothing helps. Do you have still any ideas, what it could be?

Volker 

3/18/2009 1:11:08 PM
Gravatar
Total Posts 18439

Re: Image gallery error

 Do you have these settings in your Web.config file:

<add key="FolderGalleryRequiredPath" value="FolderGalleries" />
<add key="FolderGalleryCachePath" value="/Data/systemfiles" />

Hope it helps,

Joe

 

3/18/2009 3:27:08 PM
Gravatar
Total Posts 5

Re: Image gallery error

Yes, I have this enties. So far my web.config is the original web.config for medium trust, just renamed. The DB entries are in the user.config.
(fyi: I have the version 2.2.9.2 MSSQL)

4/5/2009 8:46:23 AM
Gravatar
Total Posts 18439

Re: Image gallery error

Hi knoess,

2009-03-16 16:04:11,624 ERROR mojoPortal.Web.mojoBasePage - 77.56.59.125-de-CH - /mojo/fotos-simple.aspx
System.Reflection.TargetInvocationException: Property accessor 'Link' on object 'mojoPortal.Web.Controls.FolderGallery.AlbumFolderInfo' threw the following exception:'The type initializer for 'mojoPortal.Web.Controls.FolderGallery.ImageHelper' threw an exception.' ---> System.TypeInitializationException: The type initializer for 'mojoPortal.Web.Controls.FolderGallery.ImageHelper' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity)
at System.IO.Directory.CreateDirectory(String path)
at mojoPortal.Web.Controls.FolderGallery.ImageHelper..cctor()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission

The error seems to indicate insufficient permission to create the folder /Data/systemfiles/FolderGalleryCache

Its attempting to create it in the constructor of ImageHelper

if (Caching == ImageCacheLocation.Disk)
{
if (
(HttpContext.Current != null)
&&(ConfigurationManager.AppSettings["FolderGalleryCachePath"] != null)
)
{
string baseDir = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["FolderGalleryCachePath"]);

_imageCacheDir = Path.Combine(baseDir, "FolderGalleryCache");


}
else
{

_imageCacheDir = Path.Combine(HttpRuntime.CodegenDir, "Album");
}


Directory.CreateDirectory(_imageCacheDir);
_appPath = HttpRuntime.AppDomainAppPath;
if (_appPath[_appPath.Length - 1] == '\\')
{
_appPath = _appPath.Substring(0, _appPath.Length - 1);
}
}

I believe the line where it throws this exception is:

Directory.CreateDirectory(_imageCacheDir);

So it seems clear the web process cannot create this folder, it does not have permission. So the solution must be to give it permission to create folders beneath /Data/systemfiles

I will add code there in the next release to check if the directory exists first so that we can possibly avoid this error if the folder is created manually.

Hope it helps,

Joe

 

 

4/5/2009 12:20:40 PM
Gravatar
Total Posts 5

Re: Image gallery error

Hi Joe,

thanks for your research. Yes thats points into the right direction. In the meantime, I've got the mojoPortal also running on my local computer and I found the problem. My portal is running in a separate directory not in the root, so the configuration in your web.config is pointing to a directory outside from my mojo portal application. So it's clear that the access is not allowed. The solution is quit easy only one character to add "~" ;-) 

<add key="FolderGalleryCachePath" value="~/Data/systemfiles" />

Best Regards
Volker

You must sign in to post in the forums. This thread is closed to new posts.