ASP.NET MVC 直接返回js语句,不显示页面

  public ActionResult DetailsFAQ(string projectCode)
        {
            Document document =  new Document();
          
            if (projectCode._IsNullOrEmpty())
            {
                throw new Exception("参数异常!");
            }
            ProjectService projectService = new ProjectService(CurrentUser.Account);
            Project project = projectService.GetProjectByCode(projectCode);
            if (project == null)
            {
                return new ContentResult() { Content = "<script>alert('该FAQ对应的项目为空!'); window.parent.closeModalDialog();</script>" };
            }
     
            return View(document);
        }

原文地址:https://www.cnblogs.com/hobby0524/p/8417992.html