小编Ser*_*rım的帖子

如何获得可以为空的字符串值?

[HttpGet]
public ActionResult Login(string? returnUrl)
{
    if (Request.IsAuthenticated)
    {
        if(returnUrl.HasValue)
           return RedirectToAction("Index", "Home");
        else
           return RedirectToAction(returnUrl);
    }
    return View();
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

错误:'System.Web.Mbv.Controller.Redirect(string)'的最佳重载方法匹配有一些无效的参数

如何使用可空字符串 RedirectToAction()

c# variables asp.net-mvc nullable

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

标签 统计

asp.net-mvc ×1

c# ×1

nullable ×1

variables ×1