Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Helpers/Query.cs @ 10483

Last change on this file since 10483 was 6226, checked in by msammer, 14 years ago

#1446 rebuild the shown table. Now it is possible to make a right 'details'-call via an action within the MVC

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using HLWebOKBQueryPlugin.OKBQueryService;
6using System.ServiceModel.Security;
7
8namespace HLWebOKBQueryPlugin.Helpers
9{
10    public class Query
11    {
12        public static QueryServiceClient GetClientFactory() {
13            return GetClientFactory(GetSessionString("Username"), GetSessionString("Password"));
14        }
15
16        public static QueryServiceClient GetClientFactory(string username, string password) {
17            try {
18                QueryServiceClient client = new QueryServiceClient();
19                client.ClientCredentials.UserName.UserName = "okbtester";
20                client.ClientCredentials.UserName.Password = "okbtester";
21                client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
22                client.GetFilters();
23                return client;
24            }
25            catch {
26            }
27            return null;
28        }
29
30        public static string GetSessionString(string name) {
31            if (name != null) {
32                object o = HttpContext.Current.Session[name];
33                if (o != null) {
34                    return o.ToString();
35                }
36            }
37            return string.Empty;
38        }
39    }
40}
Note: See TracBrowser for help on using the repository browser.