.net后台重定向

HttpApplication app = sender as HttpApplication;
HttpContext context = app.Context;
context.Response.Redirect(“http://localhost:8089/”);

    protected void Application_BeginRequest(object sender, EventArgs e)
        {
    
    
            HttpApplication app = sender as HttpApplication;
            HttpContext context = app.Context;
            var curRequest = app.Request;
            var cookies = app.Request.Cookies;
            var token = cookies["wxtoken"] == null ? "" : cookies["wxtoken"].Value;
            var newestToken = "";//这个从缓存中去取

            if (!string.IsNullOrEmpty(token) && token == newestToken)
            {
    
    
                //不做操作
                context.Response.Headers.Add("Cookie", "wxtoken=7258abbd1544b6c530a9f406d3e600239bd788fb");
            }
            else
            {
    
    
                //如果token不等于缓存中token就跳转到企业微信扫码页面;
                //context.Response.Redirect("http://localhost:8089/");
            }

            //扫码通过后跳转到所有测试环境的预览选择界面
        }

Guess you like

Origin blog.csdn.net/q1923408717/article/details/118090762