I have the problem as stated that my Session object is null when called in another method after it is set in the first method.
i have one abstract class that i inherit from that looks like this
public abstract class ProxyApiService : WebService, IRequiresSessionState
{
[WebMethod(EnableSession = true)]
protected virtual string GetSecret()
{
throw new NotImplementedException("You forgot to override in derived class");
}
}
And the class that tries to read the session like this
public class APIKey : ProxyApiService
{
[WebMethod(EnableSession = true)]
protected override string GetSecret()
{
return HttpContext.Current.Session["GUID"].ToString();
}
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string setAPIKey(string path)
{
// Get data...
var guidStr = "Test";
HttpContext.Current.Session["GUID"] = guidStr;
return "";
}
[WebMethod(EnableSession = true)]
protected override string GetSecret()
{
return HttpContext.Current.Session["GUID"].ToString();
}
}