小编Zar*_*ani的帖子

无法为SOAP调用建立SSL/TLS的安全通道

我们的核心服务器通过https在多个不同的服务器上调用soap Web服务,以确认事务已完成.

代码是dotnet 3.5(vb),适用于我们设置的各种回调服务,直到我们将新的服务转移到生产环境中并拒绝通信,给出以下错误:

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException:
Could not establish secure channel for SSL/TLS with authority 'www.xyzzy.com'.
---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
Run Code Online (Sandbox Code Playgroud)

相关的代码片段似乎是:

Dim epAddr As New System.ServiceModel.EndpointAddress(sys.CallbackAddress)
Dim bind As New System.ServiceModel.BasicHttpBinding(ServiceModel.BasicHttpSecurityMode.Transport)

_svc = New CallbackSvc.XyzzyCallbackSoapClient(bind, epAddr)
Run Code Online (Sandbox Code Playgroud)

从我的个人笔记本电脑(WinXP),我可以运行代码,它连接到新服务器没有问题.

从主服务器(调用所有回调服务)(Windows Server Enterprise Service Pack 1),代码始终导致上述SSL错误.

谷歌搜索后,我尝试添加以下行(当然不适合生产,但我想测试):

System.Net.ServicePointManager.ServerCertificateValidationCallback = Function(se As Object, cert As System.Security.Cryptography.X509Certificates.X509Certificate, chain As System.Security.Cryptography.X509Certificates.X509Chain, sslerror As System.Net.Security.SslPolicyErrors) True
Run Code Online (Sandbox Code Playgroud)

结果是一样的.SSL错误仍然发生.

其他地方建议根证书没有在呼叫机器上正确安装,但新服务器和旧回调服务器都使用Go Daddy颁发的证书,所以我不认为这是这种情况.

.net vb.net ssl wcf soap

10
推荐指数
2
解决办法
3万
查看次数

jQuery AutoComplete选择更改后触发?

我正在使用jQuery UI AutoComplete控件(刚刚更新到jQuery UI 1.8.1).每当用户离开文本框时,我想将文本框的内容设置为已知良好值,并为所选值设置隐藏ID字段.此外,我希望页面在文本框的内容更改时回发.

目前,我通过让自动完成选择事件设置隐藏ID然后在文本框上设置文本框值的更改事件来实现此功能,并在必要时导致回发.

如果用户只使用键盘,这将完美地工作.您可以键入,使用向上和向下箭头选择值,然后使用Tab键退出.触发select事件,设置id,然后触发change事件并返回页面.

如果用户开始输入,然后使用鼠标虽然从自动完成选项挑,改变事件触发(如重点转移到自动完成菜单?)和页面回之前选择事件有机会来设置ID.

有没有办法让更改事件在select事件之后才会触发,即使使用鼠标也是如此?

$(function() {
    var txtAutoComp_cache = {};
    var txtAutoComp_current = { label: $('#txtAutoComp').val(), id: $('#hiddenAutoComp_ID').val() };
    $('#txtAutoComp').change(function() {
        if (this.value == '') { txtAutoComp_current = null; }
        if (txtAutoComp_current) {
            this.value = txtAutoComp_current.label ? txtAutoComp_current.label : txtAutoComp_current;
            $('#hiddenAutoComp_ID').val(txtAutoComp_current.id ? txtAutoComp_current.id : txtAutoComp_current);
        } else {
            this.value = '';
            $('#hiddenAutoComp_ID').val('');
        }
        // Postback goes here
    });
    $('#txtAutoComp').autocomplete({
        source: function(request, response) {
            var jsonReq = '{ "prefixText": "' + request.term.replace('\\', '\\\\').replace('"', '\\"') …
Run Code Online (Sandbox Code Playgroud)

javascript jquery events jquery-ui jquery-autocomplete

5
推荐指数
1
解决办法
2万
查看次数

从用户控件内添加页面控件集合

我有一个asp.net usercontrol,它代表一个"弹出"对话框.基本上,它是jQuery UI对话框的包装器,可以将其子类化以轻松创建对话框.

作为此控件的一部分,我需要将一个div注入到控件所使用的页面中,或者在窗体的顶部或底部,以便在弹出实例化时,将其父级更改为此div.这允许"嵌套"弹出窗口,而子弹出窗口中没有子弹出窗口.

麻烦的是,我找不到一种安全的方法将这个div注入页面.用户控件没有preinit事件,所以我不能在那里执行,并且在Init,Load或PreRender中调用Page.Form.Controls.Add(...)会导致标准异常"控件集合无法修改在DataBind,Init,Load,PreRender或Unload阶段."

我以为我找到了一个解决方案......

ScriptManager.RegisterClientScriptBlock(Page, Me.GetType, UniqueID + "_Dialog_Div", containerDiv, False)
Run Code Online (Sandbox Code Playgroud)

...这似乎也工作正常,但最近同事试图把一个UpdatePanel对话框内,现在她得到的错误"类型'ASP.controls_order_viewzips_ascx’和重点登记的脚本标签"ctl00 $ ContentBody $ OViewZips_Dialog_Div具有无效脚本标签之外的字符:.只能注册格式正确的脚本标签."

你应该如何从用户控件内部向页面控件集合中添加控件?

vb.net asp.net user-controls jquery-ui-dialog

5
推荐指数
1
解决办法
2万
查看次数

IEndpointBehavior 生命周期/记录服务调用

我正在尝试记录转到服务引用的所有出站请求,包括完整的请求和响应正文。我以为我有一个使用 behaviorExtensions 的解决方案,但是在部署之后,很明显扩展是在多个请求之间共享的。

这是我当前的代码:

public class LoggingBehaviorExtender : BehaviorExtensionElement
{
    public override Type BehaviorType => typeof(LoggingRequestExtender);
    protected override object CreateBehavior() { return new LoggingRequestExtender(); }
}

public class LoggingRequestExtender : IClientMessageInspector, IEndpointBehavior
{
    public string Request { get; private set; }
    public string Response { get; private set; }

    #region IClientMessageInspector

    public virtual object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
    {
        Request = request.ToString();
        Response = null;
        return null;
    }
    public virtual void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
    {
        Response = …
Run Code Online (Sandbox Code Playgroud)

c# wcf logging web-services

5
推荐指数
1
解决办法
983
查看次数

jQuery添加查询字符串到脚本加载?

将此js添加到我的页面:

$("#divExample").append("<script type='text\/javascript' src='\/scripts\/test_code.js'><\/script>");
Run Code Online (Sandbox Code Playgroud)

导致请求:

http://.../scripts/test_code.js?_=1395691742415
Run Code Online (Sandbox Code Playgroud)

我需要消除查询字符串,因为它阻止js文件被缓存.我最好的猜测是,这在某种程度上与jQuery ajax有关,它在执行某些类型的调用时会附加相同类型的查询字符串(例如jsonp).

关于我为什么这样做的背景:我需要推迟脚本加载(实际上是更大的js块的一部分),直到页面就绪事件完成之后.以上只是一个显示相同症状的减少样本.

目前正在使用jQuery 1.8.3,但我真的希望答案不包括升级,因为这会破坏依赖项.

javascript ajax jquery

3
推荐指数
1
解决办法
506
查看次数