This is a migrated thread and some comments may be shown as answers.

ScriptRegistarts.combined fails

10 Answers 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Doug
Top achievements
Rank 1
Doug asked on 22 Feb 2010, 08:42 PM
When ever I turn on .combined for either StyleScriptRegistar or ScriptRegister I receive errors.

The following is what is returned when SytleScriptRegistar has .combined(true) added


Server Error in '/' Application.

Cannot use a leading .. to exit above the top directory.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Cannot use a leading .. to exit above the top directory.

Source Error:

Line 7:      <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
Line 8:          
Line 9:      <%= Html.Telerik().StyleSheetRegistrar()
Line 10:                       .DefaultGroup(group => group
Line 11:                       .Add("telerik.common.min.css")

Source File: c:\Projects\TS\TS\TS\Views\Shared\Site.Master    Line: 9

Stack Trace:

[HttpException (0x80004005): Cannot use a leading .. to exit above the top directory.]
   System.Web.Util.UrlPath.ReduceVirtualPath(String path) +8670996
   System.Web.Util.UrlPath.ReduceVirtualPath(String path) +8671106
   System.Web.Util.UrlPath.Reduce(String path) +52
   System.Web.Util.UrlPath.Combine(String appPath, String basepath, String relative) +217
   System.Web.VirtualPath.Combine(VirtualPath relativePath) +130
   System.Web.VirtualPath.Combine(VirtualPath v1, VirtualPath v2) +53
   System.Web.VirtualPathUtility.Combine(String basePath, String relativePath) +39
   Telerik.Web.Mvc.Infrastructure.Implementation.VirtualPathProviderWrapper.CombinePaths(String basePath, String relativePath) +19
   Telerik.Web.Mvc.<>c__DisplayClass12.<ReplaceImagePath>b__11(Match match) +152
   System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) +198
   System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator, Int32 count, Int32 startat) +33
   System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) +38
   Telerik.Web.Mvc.WebAssetRegistry.ReplaceImagePath(String baseDiretory, String version, String content) +106
   Telerik.Web.Mvc.WebAssetRegistry.EnsureAsset(MergedAsset asset, String id) +550
   Telerik.Web.Mvc.WebAssetRegistry.Store(String contentType, WebAssetItemGroup assetGroup) +86
   Telerik.Web.Mvc.UI.<>c__DisplayClass3.<Merge>b__1(WebAssetItemGroup group) +68
   Telerik.Web.Mvc.UI.WebAssetItemMerger.Merge(String contentType, String assetHandlerPath, Boolean isSecured, Boolean canCompress, WebAssetItemCollection assets) +725
   Telerik.Web.Mvc.UI.<>c__DisplayClass3.<Write>b__2(WebAssetItemCollection assets) +40
   Telerik.Web.Mvc.UI.StyleSheetRegistrar.Write(TextWriter writer) +334
   Telerik.Web.Mvc.UI.StyleSheetRegistrar.Render() +98
   Telerik.Web.Mvc.UI.StyleSheetRegistrarBuilder.Render() +12
   Telerik.Web.Mvc.UI.StyleSheetRegistrarBuilder.ToString() +10
   System.Web.HttpWriter.Write(Object obj) +27
   System.Web.Mvc.SwitchWriter.Write(Object value) +50
   System.Web.UI.HtmlTextWriter.Write(Object value) +37
   ASP.views_shared_site_master.__Render__control2(HtmlTextWriter __w, Control parameterContainer) in c:\Projects\TS\TS\TS\Views\Shared\Site.Master:9
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +34
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Windows\Microsoft.NET\Framework\v4.0.21006\Temporary ASP.NET Files\root\d8654d64\8db994cb\App_Web_alv12ctp.0.cs:0
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Control.Render(HtmlTextWriter writer) +10
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +56
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060


Version Information: Microsoft .NET Framework Version:4.0.21006; ASP.NET Version:4.0.210

10 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 Feb 2010, 07:14 AM
Hi Doug,

We need more information in order to troubleshoot this problem. Could you paste the whole ScriptRegistrar code as well as the locations of the files you are trying to register? Thanks.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug
Top achievements
Rank 1
answered on 23 Feb 2010, 02:53 PM
Nothing special here:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
        
    <%= Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                      .Add("telerik.common.min.css")
                      .Add("telerik.TSDefault.css")
                      .Add("Site.css")
                      .Combined(true)
                      .Compress(true))
     %>        
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
     
</head>


And all 3 files live in the \contents directory of the project. Remember it works if the Combined is turned off.

The ScriptRegistar looks like

   <% Html.Telerik().ScriptRegistrar()
                     .DefaultGroup(group => group
                         .Add("dd_rounds.js")
                         .Combined(true)
                         .Compress(true))
                     .Render(); %>        


And again, dd_rounds.js lives in the \Scripts root directory and works with Combined(false). When combined is enabled the file asset.axd?... can't be found (404).
0
Atanas Korchev
Telerik team
answered on 23 Feb 2010, 03:18 PM
Hello Doug,

The asset.axd HTTP handler must be registered in your web.config in order to enable combination and compression. This is described in this help topic.

Could you please tell me if it all works when telerik.TSDefault.css is not registered? When combination is enabled we are having some code to fix the url of any background images. This may be the problem in your case.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug
Top achievements
Rank 1
answered on 23 Feb 2010, 03:44 PM
Ok, I had the commands in the wrong location (handlers and httpHandlers were switched). This fixed the ScriptRegistar issue but the StyleRegistar is still not working.

I do have these lines in my App.Config
  <appSettings>
    <add key="Telerik.Skin" value="TSDefault"/>
    <add key="Telerik.EnabledEmbeddedSkins" value="false"/>





0
Atanas Korchev
Telerik team
answered on 23 Feb 2010, 04:34 PM
Hi Doug,

Those lines are required if you are using RadControls for ASP.NET Ajax. What I was asking for is to comment this line and see if it works:

<%= Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                      .Add("telerik.common.min.css")
                      .Add("telerik.TSDefault.css")
                      .Add("Site.css")
                      .Combined(true)
                      .Compress(true))

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug
Top achievements
Rank 1
answered on 23 Feb 2010, 04:45 PM
Sorry, I read to quickly and didn't see that request.

I removed the line and pared it down to just telerik.common.min.css and I get the same error.
0
Atanas Korchev
Telerik team
answered on 24 Feb 2010, 07:48 AM
Hi Doug,

I have prepared a sample project which runs fine on my end. Please download it and give it a try.
What is different in your case?

Kind regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug
Top achievements
Rank 1
answered on 24 Feb 2010, 02:44 PM
Atanas,

Great support. Really appreciate the sample project. It didn't work the first time I ran it but I can't duplicate that situation anymore. It works now.

So I duplicated the web.config's into my web.config's and nothing changed. So I added Site.css to your project and it blew up with the same error. I removed site.css and noticed that it's linked in automatically. Great, I should have known that. So I went back to my application and removed site.css from the group. The page rendered without the compile error but site.css was missing from the combined file.

So next I added tsdefault, to your project. I copied the directory that contains the images and the telerik.tsdefault.css file into the project. Added the keys to the web.config file and it didn't work.

I then spent 10 minutes looking for the page that detailed how to add a custom theme to a asp.net mvc application and couldn't find it (must be under the asp.net stuff).

At this point I've spent an hour on it and am no closer to understanding how/why anything works as it's inconsistent from one application to another (yes, I'm sure there's something different but finding that needle in this hay stack is beyond my patience). Is there another way that would Tell us what's happening vs this trial and error method?
0
Atanas Korchev
Telerik team
answered on 24 Feb 2010, 02:48 PM
Hi Doug,

If you manage to get the sample project to a state when it fails - please send it over to atanas.korchev at telerik.com. I will see what is wrong. I any case I am positive that it is the image path in the CSS file. You can try fixing it by hand as if the Site.css resides at the root of your website.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Doug
Top achievements
Rank 1
answered on 24 Feb 2010, 03:07 PM
YES, that's the solution. There were references to /.. in the css files.

What's still strange is even with these url's commented out using /* */ the error was still thrown. You're parser isn't checking for comment tags.

Thanks so very much.
Tags
General Discussions
Asked by
Doug
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Doug
Top achievements
Rank 1
Share this question
or