zoukankan      html  css  js  c++  java
  • 小知识点备注01

    (1)WebService同步异步操作:

        //同步
             private void button1_Click(object sender, EventArgs e)
            {
                Service1 ws = new Service1();
                textBox2.Text = ws.ReverseString(textBox1.Text);
            }

            //异步
             private void button2_Click(object sender, EventArgs e)
            {
                Service1 ws = new Service1();
                ws.ReverseStringCompleted += new ReverseStringCompletedEventHandler(ReverseStringCompleted);
                ws.ReverseStringAsync(textBox1.Text);
            }

            private void ReverseStringCompleted(object sender, ReverseStringCompletedEventArgs e)
            {
                textBox2.Text = e.Result;
            }

    (2)IP网络地址配置:

      DNS是指:域名服务器(DomainNameServer),域名解析。

      10.0.011或10.0.012。。。

      默认网关:联网的必备ip,提供联网接口入口。

      高级-》ip设置-》添加(tcp/ip地址),可加入你需要的网段,可局域网共享。如:192.168.1.**\192.168.0.**即可

    (3)页面出现无法预知的错误:

    做好try catch 记录日志报错信息:

    1:调用接口,实例化接口对象时,可能会出错。

      页面button事件未触发接口,断点未进入,则可能网页会报错(需要vs,f5服务端调试,不要attach客户端调试)。

    2:算法判断,类型转换,判断算法是可能出错

    (4)asp页面提交文本数据时过滤屏蔽敏感词,导致无法触发到后台事件

    敏感词屏蔽,url解析参数带有%#¥@等敏感字符时,会报错,需要屏蔽掉

    页面加入ValidateRequest="true"即可

    (5)AutoPostBack="True" 

    <asp:CheckBox服务端多选按钮要先触发服务端必须加 AutoPostBack="True"回调才行 

    (6)把Response.Redirect放在Try Catch中会出现以下错误:
    Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
    try
    {
    doSth();
    Response.Rediret("a.html");
    }
    catch { }


    查了一下,原来是因为Response.Redirect会默认调用Respons.End(),而Respons.End方法会停止页的执行,并将该执行变换到应用程序的事件管线中的 Application_EndRequest 事件,所以Response.Redirect后面的代码(其实是Response.End后的代码)就不会执行了。

    解决问题的办法是:调用Response.Redirect的重载函数Response.Redirect(String url, bool endResponse),参数为false。

    如果try中有Response.End(),解决方法为:使用 ApplicationInstance.CompleteRequest 方法而不用Response.End,以避开Application_EndRequest 事件。

    (7)asp页面乱码问题解决策略

    web项目-》文件(file)-》-》gb2312改为utf8即可。

    (8)

  • 相关阅读:
    [git]git的简单配置使用 (将你的代码上传到Github)
    学习进度报告【第六周】
    [错误解决]SpringMVC接收对象 中文乱码问题解决
    [架构]myeclipse配置SpringMVC 以及简单应用 教程
    [机器学习]AttributeError: module 'tensorflow' has no attribute 'ConfigProto' 报错解决方法
    [机器学习]RuntimeError: The Session graph is empty. Add operations to the graph before calling run(). 报错解决方法
    [python]机器学习 k-mean 聚类分析
    学习进度报告【第五周】
    学习进度报告【第四周】
    unity3d优化总结篇
  • 原文地址:https://www.cnblogs.com/wangfengderizi/p/2834153.html
Copyright © 2011-2022 走看看