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

[Solved] Render() issue : ~/asset.axd?id=<> is not a valid virtual path

11 Answers 232 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.
Ganesh Shivshankar
Top achievements
Rank 1
Ganesh Shivshankar asked on 04 Sep 2009, 10:40 AM
Hi,

I have tried to use the ScriptRegistrar and StyleSheetRegistrar. I get an error whenever a Render() is called on my Content (View) page.

'~/asset.axd?id=eyJjdCI6InRleHQvY3NzIiwidiI6IjEuMy45LjAiLCJjIjp0cnVlLCJjZCI6MzY1LCJkIjpbeyJwIjoiU2NyaXB0cy9leHQtMi4yLjEvcmVzb3VyY2VzL2NzcyIsImYiOlt7Im8iOjAsIm4iOiJleHQtYWxsLmNzcyJ9LHsibyI6MSwibiI6Inh0aGVtZS1ncmF5LmNzcyJ9XX0seyJwIjoiQ29udGVudCIsImYiOlt7Im8iOjIsIm4iOiJTaXRlLmNzcyJ9LHsibyI6MywibiI6IkliZEhlYWRlci5jc3MifSx7Im8iOjQsIm4iOiJFeHQudXguZ3JpZC5Sb3dBY3Rpb25zLmNzcyJ9XX1dfQ%3d%3d' is not a valid virtual path.

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: '~/asset.axd?id=eyJjdCI6InRleHQvY3NzIiwidiI6IjEuMy45LjAiLCJjIjp0cnVlLCJjZCI6MzY1LCJkIjpbeyJwIjoiU2NyaXB0cy9leHQtMi4yLjEvcmVzb3VyY2VzL2NzcyIsImYiOlt7Im8iOjAsIm4iOiJleHQtYWxsLmNzcyJ9LHsibyI6MSwibiI6Inh0aGVtZS1ncmF5LmNzcyJ9XX0seyJwIjoiQ29udGVudCIsImYiOlt7Im8iOjIsIm4iOiJTaXRlLmNzcyJ9LHsibyI6MywibiI6IkliZEhlYWRlci5jc3MifSx7Im8iOjQsIm4iOiJFeHQudXguZ3JpZC5Sb3dBY3Rpb25zLmNzcyJ9XX1dfQ%3d%3d' is not a valid virtual path.

I'm using IIS 5.1 with Basic Authetication.

I need help out here.

Regards.
Ganesh

11 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 04 Sep 2009, 10:47 AM
Hello Ganesh Shivshankar,

Please send us the full stacktrace. We are currently not sure how to proceed with troubleshooting.

Thanks,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 04 Sep 2009, 10:50 AM
Here you go :

Stack Trace:

[HttpException (0x80004005): '~/asset.axd?id=eyJjdCI6InRleHQvY3NzIiwidiI6IjEuMy45LjAiLCJjIjp0cnVlLCJjZCI6MzY1LCJkIjpbeyJwIjoiU2NyaXB0cy9leHQtMi4yLjEvcmVzb3VyY2VzL2NzcyIsImYiOlt7Im8iOjAsIm4iOiJleHQtYWxsLmNzcyJ9LHsibyI6MSwibiI6Inh0aGVtZS1ncmF5LmNzcyJ9XX0seyJwIjoiQ29udGVudCIsImYiOlt7Im8iOjIsIm4iOiJTaXRlLmNzcyJ9LHsibyI6MywibiI6IkliZEhlYWRlci5jc3MifSx7Im8iOjQsIm4iOiJFeHQudXguZ3JpZC5Sb3dBY3Rpb25zLmNzcyJ9XX1dfQ%3d%3d' is not a valid virtual path.]
   System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) +8851275
   System.Web.VirtualPathUtility.ToAbsolute(String virtualPath, String applicationPath) +22
   System.Web.Mvc.UrlHelper.Content(String contentPath) +80
   Telerik.Web.Mvc.Infrastructure.Implementation.UrlResolver.Resolve(String url) +11
   Telerik.Web.Mvc.UI.WebAssetItemMerger.Merge(String contentType, String assetHandlerPath, WebAssetItemCollection assets) +706
   Telerik.Web.Mvc.UI.<>c__DisplayClass3.<Write>b__2(WebAssetItemCollection assets) +30
   Telerik.Web.Mvc.UI.StyleSheetRegistrar.Write(TextWriter writer) +232
   Telerik.Web.Mvc.UI.StyleSheetRegistrar.Render() +81
   Telerik.Web.Mvc.UI.StyleSheetRegistrarBuilder.Render() +12
   ASP.views_meetings_meetings_aspx.__RenderContent1(HtmlTextWriter __w, Control parameterContainer) in c:\Personal\Workspace\Nomura.IBD.CRM\Nomura.IBD.CRM.MVC.Web\Views\Meetings\Meetings.aspx:8
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   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) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   ASP.views_shared_site_master.__Render__control2(HtmlTextWriter __w, Control parameterContainer) in c:\Personal\Workspace\Nomura.IBD.CRM\Nomura.IBD.CRM.MVC.Web\Views\Shared\Site.Master:20
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.HtmlControls.HtmlHead.RenderChildren(HtmlTextWriter writer) +17
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   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) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +43
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
0
Atanas Korchev
Telerik team
answered on 04 Sep 2009, 11:36 AM
Hi Ganesh Shivshankar,

From the stacktrace it seems that you have declared a stylesheetmanager in your view page. Is that correct? Then it fails to resolve ~/asset.axd. Could you please check whether the asset.axd HTTP handler is properly registered in your web.config? Also have you made any configuration changes to your IIS 5.1 installation (I assume you are using Windows XP as operating system)?

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 04 Sep 2009, 11:51 AM

No. I'm using StyleSheetRegistrar and ScriptRegistrar. Yes, i'm using Windows XP.

<% Html.Telerik().StyleSheetRegistrar().StyleSheets(group => group

.AddGroup("Common", css => css

.Add("~/Scripts/ext-2.2.1/resources/css/ext-all.css")

.Add("~/Scripts/ext-2.2.1/resources/css/xtheme-gray.css")

.Add("~/Content/Site.css")

.Add("~/Content/IbdHeader.css")

.Add("~/Content/Ext.ux.grid.RowActions.css"))); %>

<!-- extjs -->

<% Html.Telerik().ScriptRegistrar().Scripts(sc1 => sc1

.AddGroup("Common", cj => cj

.Add("~/Scripts/ext-2.2.1/adapter/ext/ext-base.js")

.Add("~/Scripts/ext-2.2.1/ext-all.js")

.Add("~/Scripts/log4javascript.js"))); %>

I have this in Web.Config

under HttpHandlers

 

<

 

add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc"/>

 

under handlers under system.Webserver
<

 

add name="AssetHandler" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc"/>

 

 

 


This is in the master page. The Content page as another group of Scripts and thats where i'm calling the Render().

0
Atanas Korchev
Telerik team
answered on 04 Sep 2009, 11:59 AM
Hi Ganesh Shivshankar,

Unfortunately I cannot reproduce this problem at my end. I guess I cannot understand your specific configuration. Could you please send me a simple MVC app which replicates the problem? Send it as an email to atanas DOT korchev AT telerik.com.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 04 Sep 2009, 01:02 PM

Hi,

 

I tried some debugging from my side. The moment I include a Combined property it fails.

0
Atanas Korchev
Telerik team
answered on 04 Sep 2009, 01:16 PM
Hello Ganesh Shivshankar,

This is expected since asset.axd is used only for combined resources. Still I recommend you send me a zipped version of the project so I can troubleshoot it. You can strip any sensitive data - I just need the mvc application project configured to throw this exception.

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 11 Sep 2009, 09:28 AM

I fixed this issue by modifying the Teleril.Web.Mvc code in the UrlResolver class.

public string Resolve(string url)
        {
            //return helper.Content(url);
            string query;
            url = StripQuery(url, out query);
            return helper.Content(url) + query;
        }

        private static string StripQuery(string path, out string query)
        {
            int queryIndex = path.IndexOf('?');
            if (queryIndex >= 0)
            {
                query = path.Substring(queryIndex);
                return path.Substring(0, queryIndex);
            }
            else
            {
                query = null;
                return path;
            }
        }

0
Kazi Manzur Rashid
Telerik team
answered on 18 Sep 2009, 09:31 AM
Hello Ganesh Shivshankar,

Really interesting, AFAIK the Url.Content already has this logic.

Sincerely yours,
Kazi Manzur Rashid
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ganesh Shivshankar
Top achievements
Rank 1
answered on 18 Sep 2009, 09:38 AM

Hi,

 

It was precisely failing at the UrlHelper.Content. I picked up this logic from the ASP.NET MVC 2 Preview 1 source code.

 

http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=30886

Cheers,
Ganesh

0
Kazi Manzur Rashid
Telerik team
answered on 18 Sep 2009, 10:56 AM
Hello Ganesh Shivshankar,

Ok I have applied the StripQuery, it will be available in the next update, for the time being please use the code that you have sugggested.

Best wishes,
Kazi Manzur Rashid
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Ganesh Shivshankar
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Ganesh Shivshankar
Top achievements
Rank 1
Kazi Manzur Rashid
Telerik team
Share this question
or