Note that there are some explanatory texts on larger screens.

plurals
  1. POIs this supposed to work this way?
    text
    copied!<p>I have this code up on my server <a href="http://smplsite.com/sandbox2/process.asmx" rel="nofollow noreferrer">here</a> (Yes I known ASMX is a bad idea but WCF doesn't work at all for some reason):</p> <pre><code>&lt;%@ WebService Language="C#" Class="Test" %&gt; using System.Web; using System.Web.Services; [WebService(Namespace = "http://smplsite.com/smplAccess")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Test : System.Web.Services.WebService { State s; public Test() { s = (Session["foo"] ?? (Session["foo"] = new State())) as State ; } [WebMethod(EnableSession = true)] public void Set(int j) { i=j; } [WebMethod(EnableSession = true)] public int Get() { return i; } } class State { public int i = 5; } </code></pre> <p>when I run the folloing code:</p> <pre><code>class Program { static void Main(string[] args) { var ser = new ServiceReference1.TestSoapClient(); Console.WriteLine(ser.Get()); ser.Set(3); Console.WriteLine(ser.Get()); } } </code></pre> <p>I expect to get back:</p> <pre><code>5 3 </code></pre> <p>but I got back </p> <pre><code>5 5 </code></pre> <h2>My Solution</h2> <ol> <li>Usee <code>wsdl.exe</code> to generate a proxy class</li> <li>Add references as needed to get it to compile</li> <li>Use <a href="https://stackoverflow.com/questions/808168/is-this-supposed-to-work-this-way/808219#808219">Martin's</a> solution</li> </ol> <hr> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.services.webmethodattribute.enablesession.aspx" rel="nofollow noreferrer">This Seems related</a></p> <p>Edit: Added State object.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload