Store Principals between WebService calls

Topics: Customizing BugNET
Oct 3, 2014 at 9:13 AM
Hello,
when im calling:
using (var client = new ServiceReference1.BugNetServicesSoapClient("BugNetServicesSoap"))
        {                        
            var login = client.LogIn("admin", "password");            
            var result = client.GetCategories("1");
        }
LogIn is returning true, but when im trying to get categories it's throwing me null exception on Session["IsAuthenticated"] caused by not storing Princiapls from LogIn. Can you tell me how to call methods in that WebService?
Coordinator
Oct 3, 2014 at 2:52 PM
sowacx wrote:
Hello,
when im calling:
using (var client = new ServiceReference1.BugNetServicesSoapClient("BugNetServicesSoap"))
        {                        
            var login = client.LogIn("admin", "password");            
            var result = client.GetCategories("1");
        }
LogIn is returning true, but when im trying to get categories it's throwing me null exception on Session["IsAuthenticated"] caused by not storing Princiapls from LogIn. Can you tell me how to call methods in that WebService?
Set the cookie container when creating the web service reference to ensure the login session is maintained between requests.
 var services = new WebServices.BugNetServices
                {
                    CookieContainer = new System.Net.CookieContainer(),
                    Url = AppSettings.BugNetServicesUrl
                };