Lets say you have a site that uses forms based authentication, like an internet facing site. And then lets say that you are using Excel Services on the same farm.
So what you need is to make a cookie:
ExcelWebService.ExcelService excelService = new ExcelWebService.ExcelService();
debugWriterOutput("eService: " + excelService.Url);
excelService.CookieContainer = new CookieContainer();
excelService.CookieContainer.Add(Utilities.FBACookieAuthentication(excelService));
ExcelWebService.Status[] status;
internal static Cookie FBACookieAuthentication(ExcelWebService.ExcelService excelServiceSoapClient)
{
Authentication.Authentication auth = new Authentication.Authentication();
auth.CookieContainer = new CookieContainer();
LoginResult result = auth.Login("LoginName", "Password");
CookieCollection cookies = auth.CookieContainer.GetCookies(new Uri(auth.Url));
Cookie authCookie = cookies[result.CookieName];
return authCookie;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment