Hi comunidadmexi...,
Check this example. Now please take its reference and correct your code.
Controller
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
if (System.Web.HttpContext.Current.Session["User"] != null)
{
return View();
}
else
{
TempData["Message"] = "NO USER";
return View();
}
}
public ActionResult Popup()
{
return View();
}
}
View
Index
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
@if (TempData["Message"] != null)
{
TempData.Keep("Message");
<script type="text/javascript">
window.onload = function () {
var popup = window.open("/Home/Popup", "Popup", "toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=0,width=100,height=100,left = 490,top = 262");
popup.focus();
};
</script>
}
</body>
</html>
Popup
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Popup</title>
</head>
<body>
@if (TempData["Message"] != null)
{
<h3>@TempData["Message"].ToString()</h3>
}
</body>
</html>
Screenshot