当前位置: 首页>>代码示例>>C#>>正文


C# DataConnection.getSOAPCredentials方法代码示例

本文整理汇总了C#中DataConnection.getSOAPCredentials方法的典型用法代码示例。如果您正苦于以下问题:C# DataConnection.getSOAPCredentials方法的具体用法?C# DataConnection.getSOAPCredentials怎么用?C# DataConnection.getSOAPCredentials使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataConnection的用法示例。


在下文中一共展示了DataConnection.getSOAPCredentials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load


//.........这里部分代码省略.........
                        return;
                        //break;
                    case "checkSecurity":
                        Security security = new Security();
                        if //(security.CheckGroup(((ArrayList)requestData["groups"])))
                            (security.CheckGroup((ArrayList)requestData["groups"]))
                        {
                            response.Add("success", "true");
                        }
                        else
                        {
                            response.Add("success", "false");
                        }

                        status.Add("result", "true");
                        status.Add("message", "");
                        responsePackage.Add("data", response);
                        responsePackage.Add("status", status);

                        Response.Write(rs.Serialize(responsePackage));

                        //Response.Write(rs.Serialize(response));
                        return;
                        //break;
                }

                switch ((String)requestData["form:connectionType"])
                {
                    case "SOAP":

                         Dictionary<String, String> credentials = new Dictionary<String, String>();

                         if(requestData.ContainsKey("form:connection")) {
                            credentials = theDB.getSOAPCredentials((String)requestData["form:connection"]);
                         }

                        switch (action)
                        {
                            default:
                                String soapEnv = "";
                                Random r = new Random();
                                DateTime created = DateTime.Now;
                                string nonce = Convert.ToBase64String(Encoding.ASCII.GetBytes(SHA1Encrypt(created + r.Next().ToString())));
                                    soapEnv += "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>";

              		                        String securityHeader = "";
                                  securityHeader += "<wsse:Security soapenv:mustUnderstand='1' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>";
              		                      securityHeader += "<wsu:Timestamp wsu:Id='" + System.Guid.NewGuid().ToString() + "' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>";
                                  String createdDate = TimeZoneInfo.ConvertTimeToUtc(created).ToString("yyyy-MM-dd'T'HH:mm:ss.FFF'Z'");

                                  String expirationDate = TimeZoneInfo.ConvertTimeToUtc(created).AddSeconds(30).ToString("yyyy-MM-dd'T'HH:mm:ss.FFF'Z'");
              		                      securityHeader += "<wsu:Created>" + createdDate + "</wsu:Created>";
              		                      securityHeader += "<wsu:Expires>" + expirationDate + "</wsu:Expires>";
              		                      securityHeader += "</wsu:Timestamp>";
                                  if (credentials.ContainsKey("userid"))
                                  {
                                      securityHeader += "<wsse:UsernameToken wsu:Id='" + System.Guid.NewGuid().ToString() + "' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>";
                                      securityHeader += "<wsse:Username>" + credentials["userid"] + "</wsse:Username>";
                                      securityHeader += "<wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>" + credentials["password"] + "</wsse:Password>";
                                      securityHeader += "<wsse:Nonce EncodingType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'>" + nonce + "</wsse:Nonce>";
                                      securityHeader += "<wsu:Created>" + createdDate + "</wsu:Created>";
                                      securityHeader += "</wsse:UsernameToken>";
                                  }
              		                      securityHeader += "</wsse:Security>";

                                  soapEnv += "<soapenv:Header>";
开发者ID:RandomMinds,项目名称:WebAppToolkit,代码行数:67,代码来源:default.aspx.cs


注:本文中的DataConnection.getSOAPCredentials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。