Silverlight with ASP.NET http context gotcha

Encountered an old problem at work today. A Silverlight application which talks to an svc on the same web host wasn’t correctly sharing the same session. You could see this as the httpContext was different between the web site calling the Silverlight control and the site receiveing a request from Silverlight. It’s a simple problem; when you add a refrence to a service Visual Studio will create an endpoint in the config file, something like However, when you test you might just use localhost. If there is a mismatch then the session will NOT be shared. I tend to pass the endpoint address from the web site in the Silverlight initParams, I find this easier than trying to post the .host by your milage may vary. NB. This is also important when hosting on a system that uses some form of https proxy as this causes the host to look like http but you need to pass https from the client, e.g. your Silverlight control.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s