我有一个 Flash 站点,它从 URL 读取深层链接,然后使用 c# asp.net 读取 url 并为所请求的页面写入适当的元标记。
例如获取
www.domain.com/en-gb/scene4/subscene2
并将适当的元标记输出到页面
然后我们重定向到包含“#”的 swfaddress 友好页面
www.domain.com/#en-gb/scene4/subscene2
我尝试在 Webforms 和 MVC 中执行此操作,但两次都遇到问题..基本上我有点迷失了,可以提供一些建议或一个很好的例子获得灵感。
网络表单
使用 webforms,我需要为我可以接收的每个 url 路径组合创建一个 url 映射,或者使用 IIS 将所有 404 错误重定向到 default.aspx。
MVC
这似乎是一种更合适的路由 url 和获取值的方法,但是我最终会在我的 url 上加倍,否则我会丢失我的信息,例如
www.domain.com/en-gb/scene4/subscene2#en-gb/scene4/subscene2
这不能用作 url,而且当我创建太多路径时,我的 Flash 影片会停止显示。
阿贾克斯
我听说可能的另一种方法是仅使用带有 # 的 URL,而不是重定向,而是使用 Jquery 读取“#”后的路径,并使用 Ajax 调用从服务器端请求元数据。我还没有尝试过这条路。
I have a flash site which reads deep links from the URL, then using c# asp.net we read the url and write the appropriate meta tags for the page being requested.
e.g. GET
www.domain.com/en-gb/scene4/subscene2
and outputs appropriate meta tags to page
Then we redirect to the swfaddress friendly page containing the '#'
www.domain.com/#en-gb/scene4/subscene2
I have tried doing this in both webforms and mvc but run into problems both times..Basically I'm a bit lost and could do with some advice or a good example to get inspiration.
Webforms
with webforms I would need to create a url mapping for every combination of url paths i could receive or use IIS to redirect all 404 errors to default.aspx.
MVC
This seems a more appropriate way of routing the url and obtaining the values however I end up doubling up on my url else i lose my info e.g.
www.domain.com/en-gb/scene4/subscene2#en-gb/scene4/subscene2
this is not acceptable to use as a url, plus when i create too many paths my flash movie stops displaying.
Ajax
Another method I heard is possible is to only use the URLs with the # and not redirect but use Jquery to read the path after the '#' and an Ajax call to request the meta data from the server side. I haven't tried this path yet.
发布评论
评论(1)
在 MVC 路线上解决了这个问题,我的问题是将 JavaScript 中的第二次重定向的 swf 电影定位到 /Content。现在看起来效果很好。在第二次重定向时,如果 # 存在,我不会更改 window.location,因为除非文化发生变化,否则我的模型存储在会话对象中。
Solved this on the MVC route, my problem was on targeting the swf movie on 2nd redirect in JavaScript to /Content. Appears to work well now. On second redirect I don't change window.location if # is present, as stored my model in a session object unless by culture changes.