闪存XML配置文件的问题asp.net MVC [英] Flash XML config file problems with asp.net MVC

查看:128
本文介绍了闪存XML配置文件的问题asp.net MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个asp.net MVC应用程序,我第一次这样做。我有一个Flash组件,我需要在一个视图中使用。我已经包括SWF文件等在文件夹的内容,并从我的观点引用它,闪存文件加载时,你得到的观点,太棒了。

I'm creating an asp.net MVC app, first time I've done this. I have a flash component I need to use in a view. I have included the SWF files etc in the Contents folder and referenced it from my view, the flash file loads when you get to the view, great.

是因为闪存文件引用和XML文件配置数据的问题,我得到一个错误访问该XML文件。我猜这是因为闪存正在寻找一个相对路径,并使用该页面,这显然是一个MVC的URL,因此不会是指在磁盘上的实际位置的URL,因此XML文件不存在。

The problem occurs because the flash file references and XML file for its configuration data, and I'm getting an error accessing that XML file. I'm guessing this is because flash is looking for a relative path and is using the URL for the page, which is obviously an MVC url and so does not refer to an actual location on disk, so the XML file is not there.

我想答案显然是改变Flash文件中的内容看文件夹的XML文件,但是这意味着重新编译一闪,我所知甚少闪光,所以我想避免这样做。那么,有没有办法让XML文件中的相同的URL视图展现出来,所以在目前,对位于HTTTP闪光灯组件的页面://本地主机/上传/所以我猜的XML文件需要从 HTTP访问://localhost/upload/flash-settings.xml

I guess the obvious answer is the alter the flash file to look in the contents folder for the XML file, but that means re-compiling the flash, and I know very little about flash so I'd like to avoid doing that. So is there any way to get the XML file to show up in the same URL as the view, so at the moment, the page with the flash component on is located at htttp://localhost/upload/ so I guess the XML file needs to be accessible from http://localhost/upload/flash-settings.xml?

如果有任何其他更好的方式来做到这一点,而无需编辑Flash文件,即时开太,

If there's any other better way to do this, without editing the flash file, im open to that too,

推荐答案

此操作添加到FlashUpload控制器:

Add this Action to the FlashUpload Controller:

public class FlashUploadController : Controller
{
    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult FlashSettings()
    {
        var fileName = Server.MapPath("~/Contents/flash-settings.xml");

        return new FilePathResult(fileName, "text/xml");
    }
}

和这条路线到RouteTable:

And this route to the RouteTable:

routes.MapRoute("FlashSettings", "upload/flash-settings.xml",
    new { Controller = "FlashUpload", Action = "FlashSettings" });

这篇关于闪存XML配置文件的问题asp.net MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆