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)
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.
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.
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.
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.
来源:https://stackoverflow.com/questions/3478836/webpage-navigation-with-persistance-asp-net-c-sharp