小编Tus*_*har的帖子

asp .net 核心应用程序不在 IE 和 EDGE 中设置响应 cookie,但在 Firefox 和 chrome 中运行良好

我有一个带有 post 操作的登录控制器,它在成功登录后重定向到主页。我正在使用以下代码进行重定向,它在 Chrome 和 Firefox 中运行良好。但不会在 IE 和 EDGE 中重定向,并且未设置响应 cookie

private ActionResult RedirectToLocal(string returnUrl)
{
    if (Url.IsLocalUrl(returnUrl))
    {
        return Redirect(returnUrl);
    }
    else
    {
        return RedirectToRoute("default", new { controller = "", action = "" });
    }
}
Run Code Online (Sandbox Code Playgroud)

我的登录操作

public IActionResult Login(string userName, string password)
{
   try
   {
       if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
                throw new InvalidOperationException("Username/Password can not be empty");

            var session = CreateSession(userName, password);
            var returnUrl = Request.Query["returnUrl"];
            return RedirectToLocal(returnUrl);
    }
    catch (Exception ex)
    {
        ModelState.AddModelError("Login", ex.Message);
    }

        return View(); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-core-mvc

5
推荐指数
1
解决办法
2430
查看次数

为什么这个程序输出4?

使用define preprocessor指令为什么以下程序输出4而不是3?

#include <stdio.h>
#define MAX(A,B)((A)>(B)) ? A : B

int max_t(int a, int  b)
{
  return ((a)>(b)) ? a : b; 
}

int main()
{
  int i=1;
  int j=2;
  int val = MAX(++i, ++j); // this outputs 4 but why?
  //int val = max_t(++i, ++j);
  printf("%d\n", val);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c

-3
推荐指数
1
解决办法
97
查看次数

标签 统计

asp.net ×1

asp.net-core-mvc ×1

c ×1

c# ×1