Startsidan  ▸  Texter  ▸  Teknikblogg

Anders Hesselbom

Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.

Session state in .NET 3.5

2008-12-13

 This new feature saves some time, but for me, it took a while to figure it out. Or to be honest, after a while, I gave up and asked my personal guru Roger. This is the thing:In web services, to preserve session state (that is, being able to read and write session variables across multiple calls) you have to have to declare that the web method uses session state by setting that parameter in the WebMethod attribute. This could be a web method in a web service that reads and/or writes session variables: 

<WebMethod(BufferResponse:=False, enableSession:=True)> _
Public Sub SendMails()
 

In .NET 2.0, the client had code that instantiated an object representing the service, assigned a CookieContaner, and then things just worked. My problem (because of sloppy and careless reading on .NET 3.5) was that I didn’t find a property in that object to assign the CookieContainer to. This is how it’s done in .NET 3.5:

Open the config file of the client (the web service consumer). Locate the binding tag, and change the attribute allowCookies from false to true. That’s it! The feature just works! Thanks!

<binding name=”apiSoap” closeTimeout=”00:01:00″ openTimeout=”00:01:00″ receiveTimeout=”00:10:00″ sendTimeout=”00:01:00″ allowCookies=”true”…

Categories: Visual Basic 9

Tags: ASP.NET, Web

Leave a Reply

Your email address will not be published. Required fields are marked *



En kopp kaffe!

Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!

Bjud på en kopp kaffe!

Om...

Kontaktuppgifter, med mera, finns här.

Följ mig

Twitter Instagram
GitHub RSS

Public Service

Folkbildning om public service.

Hem   |   linktr.ee/hesselbom   |   winsoft.se   |   80tal.se   |   Filmtips