Html.AddCssFileParts gives error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 năm cách đây
Hi,

I am writing a plugin and I need to reference a css file in my plugin. I have added Html.AddCssFileParts like:

@{
    Layout = "";

    Html.AddCssFileParts(ResourceLocation.Head, "../Plugins/MyPlugin/Content/styles.css");
}

but I get the following javascript error:

Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.

I have also tried without 'ResourceLocation.Head', but it didn't help!


Any suggestions will be very much appreciated.

Thanks.
7 năm cách đây
[email protected] wrote:
Hi,

I am writing a plugin and I need to reference a css file in my plugin. I have added Html.AddCssFileParts like:

@{
    Layout = "";

    Html.AddCssFileParts(ResourceLocation.Head, "../Plugins/MyPlugin/Content/styles.css");
}

Try this way:


@{
    Layout = "";
    Html.AddCssFileParts(@Url.Content("~/Plugins/MyPlugin/Content/styles.css"));
}


Or simply add this way;
@{
    Layout = "";
}
<link rel="stylesheet" href="~/Plugins/MyPlugin/Content/styles.css" />
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.