【发布时间】:2013-08-17 12:34:46
【问题描述】:
我已经构建了一个自定义控件,并希望在其中添加一个嵌入式 js 文件。我认为我做的一切都是正确的,并且控件按预期编译。
我已将 js 文件标记为 Build Action "Embedded Resource"
简化控制:
[assembly: WebResource("GoogleMapsLegend.js", "application/javascript", PerformSubstitution = true)]
namespace CustomControls
{
public class GoogleMapsLegend : WebControl
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.Page.ClientScript.RegisterClientScriptInclude(typeof(CustomControls.GoogleMapsLegend), "GoogleMapsLegend", Page.ClientScript.GetWebResourceUrl(typeof(CustomControls.GoogleMapsLegend), "GoogleMapsLegend.js"));
}
}
}
当我在 DotNetNuke 环境中运行控件时,我得到一个 404
加载资源失败:服务器响应状态为 404(未找到) http://testenvironment.dev.nl/WebResource.axd?d=9ubkUMGTBWycKhgQIG5UHmzbPQjp5hcuPdO…jQr5YlIXdwqph6fJIVdtyKxWHJnyuIP44D9akltG8kiDFVFdwSND0&t=635122452802549563
我需要在 web.config 中添加其他设置吗?
我尝试将以下内容添加到 web.config,但到目前为止没有运气。
<add verb="*" path="WebResource.axd" validate="true" type="System.Web.Handlers.AssemblyResourceLoader" />
是否可能与 Telerik.Web.UI.WebResource.axd 存在冲突?
【问题讨论】:
标签: asp.net custom-controls dotnetnuke webresource.axd