c# - How to share session between a MVC project and a WCF project? -


i have angular-webapi-mvc-wcf solution.

i want share user session between mvc , wcf projects. possible?

also, want share authentication mechanism, mean, want user authenticated once on mvc project using formauthentication, , let wcf know when user authenticated without envolving other technologie.

i have solution mvc , wcf app reside on same project(dll), , on context can share authentication , session data.
so, in order share session, should move svc files wcf mvc project? way?

all projects share same db, solve without having store session data on db level.

thanks info

if wcf layer on same app pool, can check aspxauth cookie (forms auth cookie name configurable) , can use methods in formsauthentication class/namespace decode cookie user in wcf layer.

if configure forms auth cookie domain cookie can host wcf layer in different app pool/iis site long it's on same domain main site. both sites receive cookie.

that cookie drives forms authentication. if formsauthenticationmodule sees cookie in request cookies collection retrieves user cookie (decrypts it) , creates authenticated session.

optionally, create cookie creating log in method in wcf layer , have create forms cookie in wcf site. logging out of main site not log out webservices you'd have call log out on web services layer when user logs out of main site , vice versa.

if configure site use forms auth in url mode can authenticate without cookie, have pass formsauth ticket around in every single url...

as sharing session data, can configure asp.net session state db based instead of process based. in doing asp.net put session data in database you, not need yourself. https://support.microsoft.com/en-us/kb/317604#bookmark-3


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -