Silverlight 独立存储和主机名重定向
我有一个网站,提供相当强大的 Silverlight RIA,它使用了isolatedStorage。 SL 应用程序由 https://www.site.com/Application 提供(MVC 查看托管 SL 对象标签等)。它也由 https://site.com/Application 提供。其中固有的问题是,这将创建两个单独的isolatedStorage应用程序,因为两个主机名被视为不同。
我的第一个想法是只从绝对链接而不是相对链接提供 XAP 文件:
<param name="source" value="http://site.com/ClientBin/app.xap" />
但是当页面从 www.site.com 提供并且 xap 从 site.com 提供时,这似乎会导致奇怪的问题。
我的下一个想法是保留一个相对链接,但始终从 www.site.com/application -> 进行永久重定向 (301)。 site.com/application 以确保始终从同一位置提供服务。有什么想法或建议吗?有人见过这个吗?
I have a site that serves up a pretty substantial Silverlight RIA and it makes use of IsolatedStorage. The SL app is served up from https://www.site.com/Application (MVC View that hosts the SL object tags, etc). It is also served up from https://site.com/Application. The problem inherent in this is that this will create two separate IsolatedStorage application because the two host names are seen as different.
My first thought was to just serve the XAP file from an absolute link instead of a relative one:
<param name="source" value="http://site.com/ClientBin/app.xap" />
But this seemed to cause weird problems when the page was served from www.site.com and the xap was served from site.com.
My next thought was to leave it a relative link, but always do a permanent redirect (301) from www.site.com/application -> site.com/application to ensure that it is always served from the same location. Any thoughts or suggestions? Has anyone seen this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您会遇到“奇怪的问题”,因为主机页面是由与 XAP 不同的站点提供的,因此访问 HTMLPage 并尝试调用 Javascript 将失败。
使用 301 不会改变这些条件,因此您仍然会遇到问题。
您需要决定希望应用程序从哪个站点运行并对整个页面执行重定向。
就我个人而言,如果我要构建一个重要的 RIA 应用程序,我只会允许它从一个站点“site.com”运行。我会创建一个“www.site.com”,它重定向到“site.com”,它实际上从未提供任何内容,只是重定向。
You get "wierd problems" because the host page is served from a different site than the XAP hence access to the HTMLPage and attempts to call Javascript will fail.
The use of 301 doesn't change these conditions so you still have problems.
You will need to decide which site you want the application to run from and perform a redirect on for the entire page.
Personally if I were to build a substantial RIA application I would only allow it run from one site "site.com". I would create a "www.site.com" which redirects to the "site.com" that never actually serves any content just redirects.