61144

Sessions in self-hosted WCF services

Question:

prompt please how can I use session in self hosted WCF? I need to implement ASP.NET like sessions (client identification and possibly data sharing). Is there any native way to do so in WCF or I have to implement this behavior manually (sending some unique value with each request and storing them in some sessionID store)? Thanks in advance. P.S. Sorry for poor English.

Answer1:

You can have sessions in self-hosted WCF, but you'll need to use a binding which has session support. WSHttpBinding, NetTcpBinding and NetNamedPipeBindings all support sessions, as well as other combination of binding elements in custom bindings. You won't be able to use sessions in a BasicHttpBinding, for example, since you won't have the underlying ASP.NET session object it can take advantage of.

Recommend

  • Windows Azure VM availability/Failover steps
  • Accesing properties in a UserControl from the MainWindow (WPF/MVVM)
  • Pre-loading browser clipboard for testing pasting into fields with watir-webdriver
  • request follow redirection without post data
  • iOS - How to access the device's file library?
  • Performance of System.IO.ReadAllxxx / WriteAllxxx methods
  • Renewing Cookie-session for express.js
  • How to Cache Images Dynamically-Generated with PHP?
  • passing parameter to server in ExtJs
  • What is wrong in my MVC implementation?
  • Slowly changing dimension - What is Pure type 6 implementation
  • SQL append distinct values from two columns and two tables
  • Hibernate: Inheritance and relationship mapping + generics
  • UML diagram generator in Visual Studio 2010
  • android-support-v7-appcompat has same attrs as actionbarsherlock library
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • Should I use composite primary keys in Grails?
  • retrieving data from url in iphone
  • Unique Permutations - with exceptions
  • Embedded Glassfish JPA Datasource connection fail
  • Compare struct to a constant in C
  • Wrong labels when plotting a time series pandas dataframe with matplotlib
  • How do I display a dialog that asks the user multi-choice questıon using tkInter?
  • 550 Access denied - Invalid HELO name
  • how does System.Web.HttpRequest::PathInfo work?
  • Android application: how to use the camera and grab the image bytes?
  • Custom Tabgroup Appcelerator
  • Test if a set exists before trying to drop it
  • Chrome doesn't support silverlight anymore? How to solve this?
  • why do I get the error when installing the gem 'pg'? [duplicate]
  • QLineEdit password safety
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Symfony2: How to get request parameter
  • Calling of Constructors in a Java
  • log4net write single file for each call to log.info
  • Getting error when using KSoap library to consume .NET web services
  • embed rChart in Markdown
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app