具有持久性的网页导航 - ASP.NET C#
我有一个已经用 ASP.NET 完成的网站。我需要在底部添加一个部分来保存实时流视频聊天(Flash 对象),并且我需要它在不同的页面访问中持续存在。
例如,我有可能被访问的 profile.aspx 和 local.aspx,并且我需要底部的小聊天框架在页面更改之间保持不变。
这是一张图片:
alt text http://c3gl.com/pageper.jpg
我能做的唯一方法认为要做到这一点...
使整个网站在页面上动态加载它需要的内容。 或者也许使用底部框架? (不喜欢这个想法)
有没有其他方法可以做到这一点,或者考虑到我已经有一大堆 aspx 了,有没有一种方法可以轻松实现我需要的内容?
编辑:我忘了提及,聊天是流视频聊天。 (闪光对象)
I have a website that is already completed in ASP.NET. I need to add a section at the bottom that holds a live streaming video chat (Flash Object), and I need it to persist over different page visits.
e.g. I have profile.aspx and local.aspx that might be visited and I need the little chat frame at the bottom to persist between page changes.
Here's a pic:
alt text http://c3gl.com/pageper.jpg
The only ways I can think to do this are...
Make the whole website on page that just dynamically loads what it needs.
or use a bottom frame maybe? (not a fan of this idea)
Is there any other way to do this, or a way to easily implement what I need given the fact that I have a whole bunch of aspx's already?
Edit: I forgot to mention, the chat is a streaming video chat. (flash object)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一种可能的解决方案是,您可以将两个页面作为单独的 iframe 放置在父页面下。然后,更改的框架可以更改并导航到其他页面,同时聊天框架保持不变。
One possible solution is that you could put both pages as individual iframes under a parent page. The changing frame could then change and navigate to other pages while the chat frame remains constant.
如果您需要聊天窗口真正持续存在,那么您需要避免页面加载。实现此目的的唯一方法是使用框架或 AJAX 调用。
我认为如果您不想进入并修改现有页面,那么使用框架确实是您最好的选择。如果您不需要在聊天部分和主页之间进行通信,这将是完成任务的最快、最简单的方法。
另一种选择(可能不是您想要的)是缓存一些聊天会话,并在用户更改页面时重新加载它。这样,他们保留了聊天历史记录,但聊天部分在页面重新加载期间消失。使用母版页或向每个页面添加聊天用户控件将是完成此任务的最佳方法。
If you need the chat window to truly persist, then you need to avoid page loading. The only ways to do this are with frames or AJAX calls.
I think using a frame is really your best bet here if you don't want to go in and modify your existing pages. If you don't need to communicate between the chat section and the main page, this will be the quickest and easiest way yo get things done.
Another option, which is probably not what you're looking for, would be to cache some of the chat session and reload it when the user changes pages. This way, they retain their chat history, but the chat section disappears during page reloads. Using a Master page or adding a Chat user control to each page would be the best way to get this done.
实际上根本不保留聊天框,保留聊天。就像 Facebook 一样,每个页面都会有一个新的聊天框,并且该聊天框会定期获取聊天的当前状态。
如果您保留实际的聊天框,它将不起作用,因为不同的选项卡将处于不同的状态。
Don't actually persist the chat-box at all, persist the chat. Do it like facebook's, where every page gets a new chat-box, and that chat-box obtains the current state of the chat on a regular basis.
If you persist the actually chat-box it won't work, as different tabs will be in different states.
您在数据库之上运行吗?为什么不将聊天流量放入数据库并在加载新页面时将其重新加载?如果您只想保留少量文本(例如小窗口的屏幕空间),您甚至可以使用会话状态。
将持久区域设为用户控件(.ascx 文件),以便您可以将保存和重新加载封装在一个位置,并轻松将其添加到您想要的任何页面。
您使用母版页吗?如果是这样,只需将 .ascx 放入母版页中即可。您可能根本不需要更改您的各个页面。
要保存输入的聊天框文本,您必须使用 AJAX。我会使用 JQuery 之类的东西(与 ASP.NET WebMethods 和 .asmx 配合使用)以设定的时间间隔将聊天框内容发布回服务器。
Do you run on top of a database? Why not put the chat traffic into the database and load it back in when new pages are loaded? If you only want a small amount of text preserved (say the screen space of a small window) you could even use the session state.
Make the persistent area a user control (.ascx file) so you can encapsulate the saving and reloading in one place and easily add it to whichever pages you would like.
Do you use master pages? If so, just put the .ascx in a master page. You may not have to alter your individual pages at all.
To save the chat box text as it is entered you will have to use AJAX. I would use something like JQuery (works great with ASP.NET WebMethods and .asmx) to post the chat box contents back to the server at a set interval.