How-to: Adding Support for ASP.net Session ID to Synergy Connectivity Client
What does the code do?
Get the ASP.net session ID from the web server and forward it to the subsequent WCF request so that the session on the server can be reused. The ASP.net session ID follows the standard protocol on session handling:
- The first WCF request is a normal request that does not contain any session ID.
- The web server will send a response with a new session ID in the HTTP response header.
- Retrieve the session ID and store it locally.
- This session ID will be added to the HTTP request header before sending the next WCF request.
How to use it?
- Add the 2 vb files from the attachment to the project.
- Declare an instance level variable for WebSessionBehavior.
Private sessionBehavior As WebSessionBehavior |
Note: |
It is very important that this variable should remain available for use throughout the entire application life cycle because this object is responsible for storing the ASP.net session ID. If it is destroyed and recreated, then a new ASP.net session ID will be obtained on the next WCF request, which causes the server to recreate a new session. |
- Add the behavior after creating the proxy client (as displayed in the following, in bold italic).
Dim ent As New EntityEngine.EntityClient ent.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation ent.Endpoint.Address = New System.ServiceModel.EndpointAddress("http://localhost/242/services/exact.entity.svc") ent.Endpoint.Behaviors.Add(sessionBehavior) |
- The task is complete. The task to handle the session ID will be handled by the two new classes (ClientMessageInspector & WebSessionBehavior).
Limitation
- This only works for web services hosted in IIS, such as those from Exact Synergy Enterprise. It does not work with Exact Globe yet.
Main Category: |
Support Product Know How |
Document Type: |
Online help main |
Category: |
On-line help files |
Security level: |
All - 0 |
Sub category: |
General |
Document ID: |
19.725.603 |
Assortment: |
Exact Synergy Enterprise
|
Date: |
20-05-2010 |
Release: |
|
Attachment: |
|
Disclaimer |