Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [SessionState(System.Web.SessionState.SessionStateBehavior.Required)]
- public class HomeController : Controller
- {
- // GET: Home
- public ActionResult Index()
- {
- return View();
- }
- public async Task<ActionResult> Check1()
- {
- Session["Test"] = "Check";
- System.Diagnostics.Debug.WriteLine("Session: " + Session["Test"]);
- await Task.Delay(20000);
- return View();
- }
- public ActionResult Check2()
- {
- var test = Session["Test"];
- ViewBag.Test = test;
- return View();
- }
- }
- @{
- ViewBag.Title = "Check1";
- }
- <h2>View with Delay</h2>
- @{
- ViewBag.Title = "Check2";
- var check = ViewBag.Test;
- }
- <h2>Immediate View @check</h2>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement