Medium trust and skin layout problem

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
12/9/2008 5:11:30 AM
Gravatar
Total Posts 18

Medium trust and skin layout problem

Hi,

I'm using 2.2.7.8 and have been trying to test my website in medium trust using my PC , by following the documentation in http://www.mojoportal.com/mediumtrust.aspx

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.
 

After changing these, the skin are lost. Then I copied the skin folder to App_Themes\default as mentioned. E.g. App_Themes\default\cuz-mitchinson-business3.

Bu after I did those, the skin are not shown correctly. Although I still can see it is using the skin I want (image, text color, etc), but the layout just way out. I touched on web.config, clear the cache, open another browser (IE, firefox), test in another pc, all still the same. I then tried with the standard mojoportal skin (mitchinson-business3, styleshout-techmania), also having the same problem.

I wonder if I did it correctly?

(BTW, for the step 4 above, i didn't see it tells me setting I need to add in Web.config, it just finish setup normally just like when running in full trust, is this correct?)

Thanks for any advice.

12/9/2008 5:32:01 AM
Gravatar
Total Posts 18439

Re: Medium trust and skin layout problem

I recommend use the latest version, 2.2.7.9

After changing these, the skin are lost. Then I copied the skin folder to App_Themes\default as mentioned. E.g. App_Themes\default\cuz-mitchinson-business3

Thats not correct, you should copy the contents of the cuz-mitchinson-business3 into the default folder, not as a sub folder.

(BTW, for the step 4 above, i didn't see it tells me setting I need to add in Web.config, it just finish setup normally just like when running in full trust, is this correct?)

Those settings don't make it run in medium trust, it makes it possible to run in medium trust. To simulate medium trust on your machine, look for this in a commented section of Web.config, and uncomment it:

<trust level="Medium" originUrl=".*" />

In hosting this is set by the host in machine.config, but on your own machine you can do it in Web.config

Then visit the setup page again and it should show the needed setting for lucene search engine, which can go in user.config

Hope it helps,

Joe

 

12/13/2008 8:00:01 AM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

Hi,

I've changed to use version 2.2.7.9 (release package). And copy the skin contents to App_Themes\default, but the problem still the same. Tried deploy to the host (which is using medium-trust) and it got the same problem as well. Please help.

The following is the currentlog.config i get:

2008-12-13 21:29:45,968 ERROR mojoPortal.Web.Global - 127.0.0.1-en-US - /mytest/Data/Sites/2/skins/mytest-mitchinson-business3/csshandler.ashx?skin=mytest-mitchinson-business3&config=style.config&add=
System.Web.HttpException: The file '/mytest/Data/Sites/2/skins/mytest-mitchinson-business3/csshandler.ashx' 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.UI.SimpleHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

 

Thanks in advance.

12/13/2008 8:04:41 AM
Gravatar
Total Posts 18439

Re: Medium trust and skin layout problem

I think the Web.config for medium trust may be missing a key in the 2.2.7.9 release.

Look in the httpHandlers section and if you don't see this, add it there:

<add verb="*" path="*csshandler.ashx" type="mojoPortal.Web.UI.CssHandler, mojoPortal.Web" />

I will be making a new release within the next few days.

Hope it helps,

Joe

12/13/2008 11:40:46 PM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

Thanks for the quick reply.

I've added the httpHandlers as mentioned. But the result still the same (cache cleared, view in diff browser). The error now appears as follows:

2008-12-14 13:21:42,009 INFO mojoPortal.Web.Global - Global.asax.cs Application_End
2008-12-14 13:25:11,165 INFO mojoPortal.Web.Global - Application Started.
2008-12-14 13:25:11,197 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
 

Thanks.

12/14/2008 12:24:00 AM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

I think could this be related i'm using multiple site in my Data folder? But I never intended to use the multi site feature.

Currently there is a folder Data/Sites/2. I don't know why, but every time I run the a fresh installation with Setup/default.aspx, it always creates a folder 2, folder 1 seems never used. And I check the database (e.g. mp_users), there is only one SiteID 2. So my skin, files, etc all is using folder 2 as well.

How can I fix this? I don't mine drop all the database and do the fresh installation again, but I suspect it will always create folder 2 for me again.

Should I just delete the folder 1 first before doing the installation? (since folder 1 is included in the package, I never deleted it before)

Please advice. Thanks.

12/14/2008 8:47:38 AM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

About the site id issue, when going through the source, I traced it to the mysql 2.2.7.8.config script, where the create "mp_sites" table script ends with

... ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

If not mistaken, this would create the first site id with 2 when running initital setup?

I also found other tables in the script with different AUTO_INCREMENT = n values as well.

Not sure this issue related to my layout problem. Just running out of ideas how to trace the layout problem.

Please advice, thanks.

12/14/2008 8:56:59 AM
Gravatar
Total Posts 18439

Re: Medium trust and skin layout problem

Hi,

I already fixed the issue with the MySql install script in svn trunk and am working on packaging a new release now. It will be available later today or tomorrow. Its possibly related since the default location is expected to be under /Sites/1, but I can't be sure. The errors you posted are expected in medium trust. The custom virtualpathprovider doesn't work in medium trust and it logs the error saying it could not register it.

Using MySql with medium trust is not something I have ever tested, though its theoretically possible if the MySql connector is installed in the GAC.

In general if working with the source code I recommend use svn trunk.

One other thing to try is in Web.config set MinifyCss to false. If that solves it please let me know.

Best,

Joe

12/14/2008 10:31:48 AM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

Thanks for the quick fix.

I've tried to change the MinifyCss to false before but it gave the same result.

Just now, I updated the script from the latest svn, and setting MinifyCss = false again, there was an error when running the clean setup (I didn't note down), then refresh again, the process completed with no error. Tested, same layout problem. But found other strange problem, mp_sites seems correct, but mp_users, mp_roles, etc are empty.

The layout seems is missing the edit panel, I can't even find the 'Sign In' link on the default home page (using default skin).

Wonder could it be caused by a misplaced layout.master? Should I move the layout.master from App_Themes\default to App_MasterPages?

(So far I just updated the mysql script, the rest still using the 2.2.7.9 release. I will try again later with the latest release/svn source if required, but I really hope I don't have to reupload everything again) :)

Thanks again for your help.

12/14/2008 10:40:36 AM
Gravatar
Total Posts 18439

Re: Medium trust and skin layout problem

What OS are you using? If Vista with IIS 7, then you need to configure your application pool as "Classic"

When using svn builds or new releases, you must always upload all the files, otherwise you get into an unknown state and it will be difficult to provide support.

Hope it helps,

Joe

12/15/2008 8:52:47 AM
Gravatar
Total Posts 18

Re: Medium trust and skin layout problem

I'm glad to inform you that after uploading 2.2.8.0 (except the ClientScript and Data folders as mentioned in your blog) and doing a clean install, the layout issue has been solved. And strangely enough, I don't even have to move the skin files to App_Themes\default. (Anyhow if I move the files there, the layout problem occur again)

And yes, the app pool is already set to classic all the while.

But with this installation, I've came across several issues while doing the installation. I will post them at the Installation forum.

Thank you very much for your support and help.

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