Webpage navigation with persistance - ASP.NET C#

南笙酒味 提交于 2019-12-05 21:35:27

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!