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;
                }
            }

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

  • 相关阅读:
    IIS7最大上传附件大小配置
    数据表的identity
    服务器×××上的MSDTC不可用解决办法——Orchard(转)
    IOS项目中使用全局变量
    九宫格解锁的实现
    UINavigationControlle类详解
    jar仓库
    django安装
    django入门
    值得阅读的pyhon文章
  • 原文地址:https://www.cnblogs.com/baiboy/p/UrlEncode.html
Copyright © 2011-2022 走看看