设为首页 加入收藏

TOP

微信分享网页时自定义缩略图和简介(.net版本)(三)
2019-09-30 16:50:23 】 浏览:199
Tags:分享 网页 时自 定义 缩略 简介 .net 版本
che(string CacheKey) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; return objCache[CacheKey]; } /// <summary> /// 设置当前应用程序指定CacheKey的Cache值 /// </summary> /// <param name="CacheKey"> /// <param name="objObject"> public static void SetCache(string CacheKey, object objObject) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject); } /// <summary> /// 设置当前应用程序指定CacheKey的Cache值 /// </summary> /// <param name="CacheKey"> /// <param name="objObject"> public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration, TimeSpan slidingExpiration) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject, null, absoluteExpiration, slidingExpiration); } /// <summary> /// 设置数据缓存 /// </summary> public static void SetCache(string CacheKey, object objObject, int timeout = 7200) { try { if (objObject == null) return; var objCache = HttpRuntime.Cache; //相对过期 //objCache.Insert(cacheKey, objObject, null, DateTime.MaxValue, timeout, CacheItemPriority.NotRemovable, null); //绝对过期时间 objCache.Insert(CacheKey, objObject, null, DateTime.Now.AddSeconds(timeout), TimeSpan.Zero, CacheItemPriority.High, null); } catch (Exception) { //throw; } } /// <summary> /// 清除单一键缓存 /// </summary> /// <param name="key"> public static void RemoveKeyCache(string CacheKey) { try { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Remove(CacheKey); } catch { } } ///// <summary> ///// 清除所有缓存 ///// </summary> //public static void RemoveAllCache() //{ // System.Web.Caching.Cache _cache = HttpRuntime.Cache; // IDictionaryEnumerator CacheEnum = _cache.GetEnumerator(); // if (_cache.Count > 0) // { // ArrayList al = new ArrayList(); // while (CacheEnum.MoveNext()) // { // al.Add(CacheEnum.Key); // } // foreach (string key in al) // { // _cache.Remove(key); // } // } //} /// <summary> /// 清除所有缓存 /// </summary> public static void RemoveAllCache() { var cache = HttpRuntime.Cache; var cacheEnum = cache.GetEnumerator(); while (cacheEnum.MoveNext()) { cache.Remove(cacheEnum.Key.ToString()); } } /// <summary> /// 以列表形式返回已存在的所有缓存 /// </summary> /// <returns></returns> public static ArrayList ShowAllCache() { ArrayList al = new ArrayList(); System.Web.Caching.Cache _cache = HttpRuntime.Cache; if (_cache.Count > 0) { IDictionaryEnumerator CacheEnum = _cache.GetEnumerator(); while (CacheEnum.MoveNext()) { al.Add(CacheEnum.Key); } } return al; } } } View Code

 

Models,WeixinSignatureConfig

namespace WeixinShare.Models
{
    public class WeixinSignatureConfig
    {
        public string appId { get; set; }
        public string nonceStr { get; set; }
        public string timestamp { get; set; }
        public string signature { get; set; }
    }
}
View Code

 

步骤4:网页前端调用微信JSSDK

 

微信JS-SDK是微信公众平台 面向网页开发者提供的基于微信内的网页开发工具包。

 

通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照、选图、语音、位置等手机系统的能力,同时可以直接使用微信分享

首页 上一页 1 2 3 4 下一页 尾页 3/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇C# QRBarCode 下一篇Winform组合ComboBox和TreeView实..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目