Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

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.
4/7/2008 6:52:45 AM
Gravatar
Total Posts 43

Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Hi,

I set up a clean install of the 2.2.5.2 release of Mojoportal this morning. I created a new page, then added an HTML content widget. Upon editing the html content using the rich text editor, pressing "Update" causes an unhandled exception.

2008-04-07 12:15:23,742 [4944] ERROR mojoPortal.Web.mojoBasePage [(null)] - 130.209.144.206-en-US - /mojo/HtmlEdit.aspx?mid=1&pageid=1

System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\TEMP' is denied.
 

I am using Windows Authentication for database authorisation and authentication. I am not going to allow the domain account running mojoportal access to more than I need to - and I'm certainly not going to allow it access to part of the operating system's filesystem tree.

Presumably in a standard authentication/authorization NETWORKSERVICE must have write permisson on c:\windows\temp.

How can I configure mojoPortal's rich text editor to use the mojoinstalldir\DATA directory for it's temporary data store? Is this possible through a configuration file like the Web.Config, or must I build my own version using the source code?

Thanks,

Kenny
 

4/7/2008 7:07:33 AM
Gravatar
Total Posts 18439

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Hi Kenny,

Nothing in mojoPortal that I know of is "configured" to use the Windows\Temp folder for anything.

I would need to see the stack trace to have any idea of what is going on with this exception.

Unless you are using impersonation, then the server side code (in default configuration) is running in the context of IIS_WPG user (on Win 2003).

Best,

Joe

4/7/2008 7:12:15 AM
Gravatar
Total Posts 43

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Hi Joe,

Thanks for ruling out a confiugration issue and for your recommendation as to how to proceed. I'll peruse the stack trace and investigate further.

Indeed I am using impersonation and running mojoportal as a domain user.

Kenny

4/7/2008 7:17:02 AM
Gravatar
Total Posts 18439

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

With impersonation and windows authentication, isn't it impersonating the logged in user?

4/7/2008 10:59:27 AM
Gravatar
Total Posts 43

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Hi Joe,

With impersonation, as far as I know, ASP.NET is passing the authentication token of the user that IIS is configured to run the application as. This MSDN article explains the setup I am talking about. The setup seems to work as expected, mojoportal can log into the database and has the required permissions within the database to work up to a point.

Now it's an installation issue, but this is post may cross over into the development forums I think. I'l let you decide where it should go.

The problem is with the Lucene.Net call in Mojoportal.Business.Webhelpers.IndexHelper.RebuildIndex. From the debugging I notice that Lucene.Net tries to place lock files in a temporary directory: "C:\Documents and Settings\(myusername)\Local Settings\Temp\". On the webserver the user's temp location is not defined, so Lucene.Net is trying to use the OS temp location c:\windows\system32, probably told to by the OS.

I notice that Lucene.Net indexes are given a site specific directory (RebuildIndex in IndexHelper.cs gets a path from the function GetIndexPath), but the lock files are not.

Any ideas how to give the lock files a site-specific directory? That would fix the problem I have run into.

The system works for now by uncommenting and changing the Web.Config entry <add key="Lucene.Net.lockdir" value="(pathgoes here)\Data\Sites\1\index" /> - I suppose I could just create a folder \Data\Sites\Lockfiles - but that seems rather clumsy.

Kind regards,

Kenny

4/7/2008 11:08:14 AM
Gravatar
Total Posts 18439

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Hi Kenny,

Try adding this to your Web.config (or user.config)

<add key="Lucene.Net.lockdir" value="C:\mojoportal\mojodev\Web\Data\Sites\1\index" />

of course editing the path to match the correct physical path in your case.

This kind of configuration is needed in Medium Trust environments. Perhaps since your web server is on a domain, Medium Trust policy may be pushed down by group policy even if not configured directly on the web server.

Hope it helps,

Joe

4/7/2008 11:12:11 AM
Gravatar
Total Posts 18439

Re: Rich Text Editor using C:\WINDOWS\TEMP - System.UnauthorizedAccessException

Sorry, guess I answered without reading the rest of your post, that you already did this. If it worked, thats the solution, clumsy or not. :-)

Joe

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