There is a cgi code written in C++. Currently there is no session management done in the web pages. There is a need to provide sessions in the web pages so that the user can login, maintain session and then logoff. While this is a fairly simple task in java with HttpSession, I have no clue how to do this with C++ code.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
C++ is not like Java in the breadth of the functionality of the bundled libraries, so you need to extend the language with some extra libraries for not so common tasks (such as C++ CGI development). You can either build the library yourself to support functionality not present in the standard library, or use one developed by a third party.
In this case I'd use the NCBI C++ Toolkit. It provides a nice CGI module with session support
回答2:
Another alternative may be the "FastCGI / CGI C++ Library" that is aimed for Boost integration at someday: http://cgi.sourceforge.net/
It claims itself to provide "Configurable support for strongly-typed sessions (optional)."