无为清净楼资源网 Design By www.qnjia.com

本文实例讲述了asp.net+js实现批量编码与解码的方法。分享给大家供大家参考,具体如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
  <mce:script src="/UploadFiles/2021-04-02/jquery-1.3.2.min.js">

C#代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (Request["Id"]!=null)
    {
      string msg = "";
      msg += "<font color='red'>服务器得到的值(解码前):<br/>";
      foreach (string s in Request.Form.AllKeys)
      {
        msg += string.Format("{0}:{1}<br/>", s, Request.Form[s]);
      }
      msg += "服务器得到的值(解码后):<br/>";
      foreach (string s in Request.Form.AllKeys)
      {
        msg += string.Format("{0}:{1}<br/>", s, HttpUtility.UrlDecode(Request.Form[s]));
      }
      msg += "</font>";
      msg += string.Format("未编码的字符解码1ab&<b>小</b>:{0}",HttpUtility.UrlDecode("1ab&<b>小</b>")); ;
      Response.Write(msg);
      Response.End();
    }
  }
}

希望本文所述对大家asp.net程序设计有所帮助。

标签:
asp.net,js,批量,编码,解码

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com