SoFunction
Updated on 2025-03-06

C# WeChat sharing code

This article shares the specific code shared by C# WeChat for your reference. The specific content is as follows

Share the code on WeChat, first introduce:

<script type="text/javascript" charset="utf-8" src="/open/js/jweixin-1.1."></script>

Get the signature:

('/apijson/wxsign', {
  type: 'get',
  data: {
    url: ,
  },
  success: function (data) {
    //alert((data));
    ({
      debug: false, // Turn on debug mode, the return values ​​of all APIs called will be alerted on the client. To view the passed parameters, you can open them on the PC side. The parameter information will be printed through the log and will only be printed on the PC side.      appId: , // Required, unique identification of the official account      timestamp: , // Required to generate a signature time stamp      nonceStr: , // Required to generate a random string of signatures      signature: ,// Required, signature      jsApiList: [
      'onMenuShareTimeline',
      'onMenuShareAppMessage',
      'startRecord',
      'stopRecord',
      'onVoiceRecordEnd',
      'playVoice',
      'pauseVoice',
      'stopVoice',
      'onVoicePlayEnd',
      'uploadVoice',
      'downloadVoice',
      'chooseImage',
      'previewImage',
      'uploadImage',
      'downloadImage'
      ] // Required, list of JS interfaces to be used    });
  }
})

Share the code:

  (function () {
    var url = ;
    // Call the API here    ({
      title: "Yuyuan Dan - Send to parents and those who need gratitude the most!", // Share the title      desc: "The best product that goes out of the red wall is taken by the leaders of the party and army such as Deng Xiaoping, Yang Shangkun, and Ye Jianying for a long time!", // Share the description      link: url, // Share link      imgUrl: "http://m./images/", // Share icon      type: '', //
      dataUrl: '', // If the type is music or video, you want to provide a data link, the default is empty      success: function () {
        // The callback function executed after the user confirms the sharing      },
      cancel: function () {
        // The callback function executed after the user cancels the sharing      }
    });

    ({
      title: "Yuyuan Dan - Send to parents and those who need gratitude the most!", // Share the title      desc: "The best product that goes out of the red wall is taken by the leaders of the party and army such as Deng Xiaoping, Yang Shangkun, and Ye Jianying for a long time!", // Share the description      link: url, // Share link      imgUrl: "http://m./images/", // Share icon      type: '', //
      dataUrl: '', // If the type is music or video, you want to provide a data link, the default is empty      success: function () {
        // The callback function executed after the user confirms the sharing      },
      cancel: function () {
        // The callback function executed after the user cancels the sharing      }


    });


  });

json output by wxsign

{
  "appid": "wx888888888888",
  "jsapi_ticket": "bxLdikRXVbTPdHSM05e5u2WtcuareekEvI9AoiSB9hYDykHA-zgWRJIeoZkZivtjOGcI87SVk1r8888888888",
  "timestamp": 150358888,
  "nonceStr": "ESbJrsnzGHi8888",
  "signature": "fec1a26592ef07d52ff066183f50536888888888f5"
}

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.