无法使用 AC_FL_RunContent 在 ASP.NET MVC 中设置 Flash 文件的相对路径

发布于 2024-08-31 16:41:44 字数 854 浏览 0 评论 0原文

我有一个使用 asp.net mvc 的网站,我需要在视图中嵌入一个 flash 文件。我无法设置 Flash 文件的相对路径。下面给出的是我正在使用的代码:


 AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0',
'width', '487',
'height', '359',
'menu', 'false',
'movie', 'images/butterfly',
'quality', 'high',
'allowscriptaccess', 'sameDomain',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer'
);

我将butterfly.swf复制到一个名为images的目录中。 images 目录位于views 文件夹中。

如果我在具有相同文件夹结构的不同解决方案中使用后台代码(default.aspx default.aspx.cs),浏览器能够加载 flash 文件。

您能否解释一下 MVC 文件夹结构问题?

多谢。

马赫什

I have a website using asp.net mvc in which I need to embed a flash file in view. I am unable to set the relative path for the flash file. Given below is the code I am using:


 AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0',
'width', '487',
'height', '359',
'menu', 'false',
'movie', 'images/butterfly',
'quality', 'high',
'allowscriptaccess', 'sameDomain',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer'
);

where I copied butterfly.swf in a directory called images. images directory resides in the views folder.

If I use code behind( default.aspx default.aspx.cs) in a different solution with the same folder strucuture, browser is able to load the flash file.

Could you please throw some light on the MVC folder structure issue??

Thanks a lot.

Mahesh

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄居人 2024-09-07 16:41:44

这是因为您请求的网址如下:"/Content/Details/1",因此相对路径将指向:"/Content/Details/1/images/butterfly".您的服务器上没有该文件夹,因此不会找到它。相反,您可以解析 url 服务器端,以便它找到正确的文件夹。只需将 "images/butterfly" 更改为 <%=ResolveUrl("~/images/butterfly.swf")%> 并将该文件夹移出视图文件夹默认情况下,无法在views文件夹中请求as文件。如果您确实想将其放在视图文件夹中,则必须更改视图文件夹中的web.config以允许这样做。

请记住,像您这样的相对路径将在客户端解析。这对于 ASP.NET MVC 来说没什么特别的。客户端不知道你正在使用什么服务器端框架。客户端只需查看 url 并从那里解析它。

This is because you are requesting a url like: "/Content/Details/1" so that relative path will point at: "/Content/Details/1/images/butterfly". You don't have that folder on your server, so therefore it will not be found. Instead you can resolve the url server side so that it will find the correct folder. Just change "images/butterfly" to <%=ResolveUrl("~/images/butterfly.swf")%> and move the folder out of your views folder as files can not be requested in the views folder by default. If you really want to have it in the views folder you will have to change the web.config in the views folder to allow that.

Remember that relative paths like yours will be resolved client side. This is nothing special to asp.net mvc. The client doesn't know what serverside framework you are using. The client just looks at the url and resolve it from there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文