<%@ Application Codebehind="Global.asax.cs" Inherits="Mvcb2b.MvcApplication" Language="C#" %>
<%@ Import Namespace="MvcViewEngine"%>
<script runat="server">
public override string GetVaryByCustomString(HttpContext context, string arg) 
{
    string cacheKey = "";
    string skin = ViewEngineExtension.GetSelectSkinName_Http(context);
    string isResponsive = Fun.IsResponsive;
    string ismobile = Fun.Ismobile.ToString();    
    switch(arg) {
       case "skincache": //后台登录用户与前台没有登录用户不同的缓存
            if (isResponsive == "1")
            {
                if (Admincookie.Getcookie("Adminuser") == null || Admincookie.Getcookie("Adminuser") == "")
                    cacheKey = skin + "responsive_no_baidu_crawler" + ismobile.ToString();
                else
                    cacheKey = skin + "responsive_Adminuser_no_baidu_crawler" + ismobile.ToString();
            }
            else
            {
                if (Admincookie.Getcookie("Adminuser") == null || Admincookie.Getcookie("Adminuser") == "")
                    cacheKey = skin + "no_baidu_crawler";
                else
                    cacheKey = skin + "Adminuser_no_baidu_crawler";
            }
         break;
       case "usercache": //比skincache 多个用户（登录）缓存
         if (isResponsive == "1")
         {
             if (Admincookie.Getcookie("Adminuser") == null || Admincookie.Getcookie("Adminuser") == "")
             {
                 if (Ck.GetCookieNopass("memberlogin") == null || Ck.GetCookieNopass("memberlogin") == "") //memberlogin 用户是否登录标志
                 {
                     /*会员没有登录，跟用户名没有关系
                      * */
                     cacheKey = skin + "responsive_no_baidu_crawler" + ismobile.ToString();
                 }
                 else
                 {
                     /*会员已登录 判断用户是否游览权限(未加),每一期不一样*/
                     cacheKey = skin + "responsive_user_no_baidu_crawler" + ismobile.ToString();
                 }
             }
             else
                 cacheKey = skin + "responsive_Adminuser_no_baidu_crawler" + ismobile.ToString();
         }
         else
         {
             if (Admincookie.Getcookie("Adminuser") == null || Admincookie.Getcookie("Adminuser") == "")
             {
                 if (Ck.GetCookieNopass("memberlogin") == null || Ck.GetCookieNopass("memberlogin") == "") //memberlogin 用户是否登录标志
                 {
                     /*会员没有登录，跟用户名没有关系
                      * */
                     cacheKey = skin + "no_baidu_crawler";
                 }
                 else
                 {
                     /*会员已登录 判断用户是否游览权限(未加),每一期不一样*/
                     cacheKey = skin + "user_no_baidu_crawler";
                 }
             }
             else
                 cacheKey = skin + "Adminuser_no_baidu_crawler";
         }
         break;
       default:
         cacheKey = base.GetVaryByCustomString(context, arg); 
         break;
      }
   return cacheKey;
}
</script>