問題描述
在我的一個項目中,我有一個非常活躍的經典 ASP 站點,需要將基于實時事件的提要集成為現有 UI 的一部分.未來有計劃將站點架構升級為 MVC 或 MVP,但必須同時實現此新功能.
In one of my projects, I have a very active classic ASP site with a requirement to integrate live event-based feeds as part of the existing UI. There is a plan to upgrade the site architecture to either MVC or MVP in the future, but this new feature must be implemented in the meanwhile.
我決定為此使用 WebSocket 方法,因為這最終是我們將來想要使用的,而重新構建它沒有意義.問題是,如何將其與經典的 ASP架構"集成?
I have decided to go with a WebSocket approach for this, as this is ultimately what we will want to use in the future, and rebuilding this doesn't make sense. The question is, how to integrate this with the classic ASP "architecture"?
該網站已經實現了 jQuery 庫,并希望利用 jQuery 的功能在給定頁面上創建這些流式部分.
The site already implements the jQuery library, and was hoping to leverage jQuery's capabilities to create those streamed sections on a given page.
當前請求要求此新聞提要存在于每個頁面上.因此,加載新頁面將重新呈現新聞提要,并且應該從它留在最后一頁的位置開始.為此,我猜需要讀取位置指示器(我猜是會話變量).
The current req's ask for this news feed to exist on every page. Thus, loading a new page will re-render the news feed, and should kick of from where it left on the last page. For this, I'm guessing a position indicator will need to be read (session variable I'm guessing).
無論如何,這些都是要求.我正在考慮將整個現有的經典 ASP 站點包裝在一個 MVC 或 MVP (C#/.Net) 項目中,以允許我們在開發遺留特性時開始替換它們,例如這個.
Anyhow, those are the requirements. I was thinking of wrapping the the entire existing classic ASP site inside a MVC or MVP (C#/.Net) project to allow us to begin swapping out legacy features as they are developed, such as this one.
我想就這種情況下的一些推薦方法獲得一些建議.
I would like to get some advice on some recommended approaches for this scenario.
謝謝.
推薦答案
我會做一個 SignalR 應用程序并集成它在你的舊應用中.
I would do a SignalR app and integrate it in you old app.
很容易將 ASP 經典與 ASP.net MVC 集成.只需混合項目并從路線中排除 *.asp
It's easy to integrate ASP classic with ASP.net MVC. Just mix the projects and exclude *.asp from the routes
routes.IgnoreRoute("{resource}.asp/{*pathInfo}");
在根 (/) 中會遇到一些問題,但可以使用重定向對其進行排序.
You will have some trouble in the root (/), but you can sort it with a redirect.
對于混合身份驗證(如果需要),您需要在 MVC 中編寫自己的身份驗證,以使用您在 Classic ASP 中使用的相同身份驗證 cookie.我過去曾成功地做到這一點.
For a mixed authentication (if you need it) you will need to write your own authentication in MVC to use the same auth cookie that you use in Classic ASP. I've done this in the past with success.
這篇關于如何在經典的 ASP Web 應用程序之上集成 WebSockets?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!