zoukankan      html  css  js  c++  java
  • 【ASP】简单Url编码和Url解码实例

    描述:在数据传输或读取时,有些敏感数据不宜显示传输,特别涉及机密或财务信息,因此使用编码技术尤为重要。

    简单实例:

    URL编码代码:

    protected void Button1_Click(object sender, EventArgs e)
            {
                if (TextBox1.Text == null)
                {
                    Response.Write("<script>alert('文本不存在,无法编码')</script>");
                }
                else
                {
                    string str = TextBox1.Text;
                    string UrlEncode = Server.UrlEncode(str);
                    Label1.Text = "编码后的数据" + UrlEncode;
                }

            }

    Url解码代码:

            protected void Button2_Click(object sender, EventArgs e)
            {
                if (TextBox1.Text == null)
                {
                    Response.Write("<script>alert('文本不存在,无法编码')</script>");
                }
                else
                {
                    string str = TextBox1.Text;
                    string UrlDecode = Server.UrlDecode(str);
                    Label2.Text = "编码后的数据" + UrlDecode;
                }
            }

    扩展:加密类别的其他方式

  • 相关阅读:
    msql 计算连续签到天数
    jetty启动常用命令
    nginx负载均衡, 配置地址带端口
    IDEA java 代码格式化统一
    Linux下安装Zookeeper
    nexus admin 从文件角度进行密码重置
    Monkey测试
    接口测试
    我的IT之路
    cookie 操作(转载)
  • 原文地址:https://www.cnblogs.com/baiboy/p/UrlEncode.html
Copyright © 2011-2022 走看看