我如何从Asp.Net MVC中的静态void方法刷新Razor页面

问题描述

我有一个Razor页面(视图为PayProduct()),显示了一些会话值。这些会话值已在Void Main()方法中进行了更改。因此,如何在Razor Page中显示此新会话值。

public static class pay
    {
        public static void Main()
        {
          //Changed the sessions values 
          HttpContext.Current.Session["TrackingCode"]="123ab456"
          //return or refresh razor page of  PayProduct()  or...?.
        }
    }

 public class ExamplesController : Controller
    {
     public ActionResult PayProduct()
        {
          //somethings
         return View()// display the sessions value
        }
    }

The PayProduct()剃须刀页面

if(HttpContext.Current.Session["TrackingCode"] != null)
            {
                <div class="alert alert-info">
                    @HttpContext.Current.Session["TrackingCode"].ToString()
                </div>
            }

您如何解决此问题。谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)