2

Whilst on my local machine the following code behaves perfectly.

@Html.Raw(SquishIt.Framework.Bundle.Css()
                                   .Add("~/css/normalize.css")
                                   .Add("~/css/nonsemantic.css")
                                   .Add("~/css/custom/basic/site.css")
                                   .ForceRelease()
                                   .Render("~/css/style.min.css"))

A new minified style.min.css file is created under the specified directory.

However, when I deploy my code to my hosting provider I get an UnauthorizedAccessException with the message of "Access to the path 'C:\...\style.min.css' is denied".

I don't think it is a problem with my SquishIt implementation, but I can't for the life of me figure this one out.

Greg
  • 31,180
  • 18
  • 65
  • 85

1 Answers1

5

You might need to use your hosting provider's file management tool to give the app pool identity write access to the folder SquishIt is trying to create style.min.css in. For an example of how this is done at one hosting provider, see Setting Folder Permissions for Elmah in this tutorial:

http://www.asp.net/web-forms/tutorials/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-deploying-to-the-production-environment-7-of-12

On your local machine do you run under IIS or using the Visual Studio Development Server (Cassini)? If it's a folder permission issue you'd see the same thing locally, as in the preceding tutorial from the same series:

http://www.asp.net/web-forms/tutorials/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-setting-folder-permissions-6-of-12

tdykstra
  • 5,880
  • 2
  • 23
  • 20
  • Or see my blog http://blogs.msdn.com/b/rickandy/archive/2011/04/22/test-you-asp-net-mvc-or-webforms-application-on-iis-7-in-30-seconds.aspx – RickAndMSFT Mar 06 '12 at 01:51
  • I believe this is the correct answer, Im going to test tonight to make sure then I'll mark the answer appropriately... – Greg Mar 06 '12 at 14:01
  • Is there any possibility to manage the rights programtically without any manual intervention. – santosh kumar patro Feb 08 '14 at 16:27